Toggle Mobile Data

Learn how to navigate to the Mobile Data settings screen and toggle mobile data

  1. joaomgcd
    This is how it'll look like in the end:


    In this tutorial you'll learn how to:
    • Navigate to the mobile data system settings page
    • Check the current status of the data toggle
    • Click the toggle
    • Go back to where you were

    STEP 1 - OPEN MOBILE DATA SETTINGS


    • Create a new task and call it Toggle Mobile Data
    • Add an AutoShare action
    • Import the Data Usage intent
    • Use the intent by selecting the Settings App and the Data Usage action
    • Go back to tasker
    • Run the task to check that the correct screen appears


    STEP 2 - CHECK MOBILE DATA STATUS


    • Add an AutoInput UI Query action
    • Select the Variable Setup option
    • Navigate to the Data Usage screen
    • Select Accept in the AutoInput notification
    • Back in AutoInput select the ON option from the list
    (i) ON is the current status of the mobile data toggle in this example. If the toggle was off, it would show OFF. By selecting this from the list you'll be creating a Tasker variable with whatever value is there at the time of checking.
    • Set the variable name to status
    /!\ Please check that the Variables field was set to android:id/switch_widget=:=status after doing this.
    • Go back to Tasker
    • Add a Flash action with the text %status
    • Run the task and check that the correct status is shown in the toast
    /!\ At this point Test Task was ended might appear on the screen instead of the toggle status. This is a Tasker bug that should be fixed on a future release. If this happens, exit Tasker through the main screen with the back button so that it saves the task and go in again. If you now run the task again it should work.


    STEP 3 - TOGGLE MOBILE DATA


    • Add an AutoInput Action Tasker action
    • Set the Action to Click
    • Set the Field Type to Text
    • Set the Field Text to %status
    (i) This will make AutoInput click on whatever on-screen element has the ON or OFF text associated with it, depending on what status it's in. For example if %status contains ON AutoInput will click on that text which will correspond to the toggle on the screen thus effectively enabling or disabling mobile data.
    • Go back to Tasker
    • Run the task to check that the status is correctly toggled


    STEP 4 - GOING BACK AFTER TOGGLING


    • Add an AutoInput Global Action Tasker action
    • Choose the Back action from the list
    • Go back to Tasker
    • Test the task again and check that mobile data is toggled and you're back in Tasker where you began :cool:

    DeMichaelis likes this.

Recent Reviews

  1. mike m
    mike m
    5/5,
    This was my first use of AutoInput and AutoShare, and while it initially seemed intimidating, it really went quite smoothly. It made a great introduction to using both tools. The one trick for new users is do make sure you have both first... this setup uses both AutoInput and AutoShare in combination.
  2. REINALDO CARDOSO
    REINALDO CARDOSO
    5/5,
    Muito bom o projeto show
  3. DeMichaelis
    DeMichaelis
    2/5,
    This doesnt work on my OnePlus 6 (Android 8).
    Can anyone help me ?
  4. WAV
    WAV
    5/5,
    Works fine.Fast and without bugs