AutoInput How to auto switch on or off Mobile Data (not toggle(

Discussion in 'AutoApps' started by Felixchang, Feb 15, 2017.

  1. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
    Hi,
    I wonder if any one has example solution on how to switch off or on the mobile data using AutoInput and Tasker.
    Normally I would like to specify that once the desired WIFI connection is detected, then explicitly turn off the mobile data (regardless of current state of mobile data). Toggle of mobile data will not work some times because for some reason, it the state of mobile data is off, it will toggle it to be on.
    Tasker alone used to work well but since the newer version of Android no longer support this, I wonder if there is some simple way out.
    I looked through some examples in the AutoApps web site but they all seem to be example of toggling.
    I noticed there is a way to query the state of mobile data and then flash it as text but not sure how can I use this for my purpose.
    Any help is appreciated
     
  2. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    By gettting the current state it's just a matter of not doing anything if the state is already off :) hope this helps!
     
  3. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
    Is there any way to explicitly turn the mobile data on or off but not toggling?
     
  4. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Yes. Check the state. If it's already off and you want to turn it off just don't toggle it :p
     
  5. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
    Ok. How do I do that ?
     
  6. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Which part exactly?
     
  7. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
    How do I perform a check on the status of mobile data status, depending on if it is on or off, then will take the next action to toggle it or not.
    Do you have similar examples I could follow ?
     
  8. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    But in the OP you said "I noticed there is a way to query the state of mobile data and then flash it as text but not sure how can I use this for my purpose.". I thought you knew how to do this already?
     
  9. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
    Yes. This is the example I saw. But after getting the variable status, how do I use this to check before doing a toggling ?
    The example only showed how to get the variable, then flash it. How to use this to do a check ?
     
  10. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    What is the variable's value when you check?
     
  11. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
  12. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Add an If action in Tasker and set the condition to %status matches ON and inside the If switch the mobile data to off. If it doesn't match ON don't do anything :)
     
  13. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
    Thanks. I have done something similar last few days but just can not get it through.
    Now for instance, if I go to mobile data setting and set the ticked field variable called checkon, I see the following code:
    Only Visible:false
    Only Clickable:false
    App Package:com.android.phone
    Check Screen State:false
    Vairables:checkon()
    When I define a if statement in tasker such as
    %checkon() ~ ON
    On the task screen, to the extreme right, there is a red mark indicating probably syntax error so I can not execute it.
    In the edit menu, if I press the "coffee icon" icon, it says nothing found.
    I tried with value OFF also with the same error.
    Am I doing the right thing ? What kind of value should I assign to match ?
     
  14. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Can you show me a screenshot of that error? Thanks
     
  15. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
    Thanks. I have done something similar last few days but just can not get it through.
    Now for instance, if I go to mobile data setting and set the ticked field variable called checkon, I see the following code:
    Only Visible:false
    Only Clickable:false
    App Package:com.android.phone
    Check Screen State:false
    Vairables:checkon()
    When I define a if statement in tasker such as
    %checkon() ~ ON
    On the task screen, to the extreme right, there is a red mark indicating probably syntax error so I can not execute it.
    In the edit menu, if I press the "coffee icon" icon, it says nothing found.
    I tried with value OFF also with the same error.
    Am I doing the right thing ? What kind of value should I assign to match ?
     
  16. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
    Hi,
    This is the full workflow.
    1. I went to mobile setting screen shot 1 and 2
    2. Then I select the field Array:Checkbox not Checked (off). See screen shot 3
    3. I then defined the variable to be "checkbox". I then look at the name again to confirm. See screen shot 4
    4. Now my configuration is as shown in screen shot 5
    5. I then open the task to so a if statement and select the check box field and put the required condition. See screen shot 6, 7, 8
    6. On tasker, you can see that to the extreme right of the if statement, there is a red bar indicating some error. See screen shot 9
    Hope all is clear
     

    Attached Files:

  17. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    That red bar is not important :) Don't worry about it. Can you add a flash action to see what %checkbox() contains? Thanks
     
  18. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
    Very strange. I took away the if statement and add a flash command. But nothing run.
    See the screen output. Below there is a stop button and the process just stays there. Nothing is flashed.
     

    Attached Files:

  19. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    It seems you're not opening the screen where you toggle the data first, right? You have to open that screen, AutoInput can't do that for you.
     
  20. Felixchang

    Felixchang New Member

    Joined:
    Feb 15, 2017
    Messages:
    13
    Likes Received:
    0
    Ok. I guess I will need to buy a product called AutoApps Share ? Is this correct ?
     

Share This Page