Toggle Mobile Data (non-root)
Posted: 05 Jan 2018 18:23
Here is an example of getting mobile data state - toggle if needed flow, as it's a part of full flow, i share screenshot and descriptions of it...
device spec: Lenovo K5 Note - Android 6 - no root
this part of flow needs screen on to operate!
first and essential step: you need to dump global variables to two files and compare, like this: (of course adb shell needed and connecting phone to pc with usb debugging on)
make sure mobiledata is on, from pc adb folder:
adb shell settings list global > on.txt
turn off mobiledata from phone normal way and then second command:
adb shell settings list global > off.txt
2 files created. now time to compare these txt files with file compare programs.
my phone, this variable changes only:
mobile_data1 (can be 0 or 1 --- that variable will be used to detect mobiledata state)
and setup a flow like that as shown below, and last step, with trial and error method, find the XY coordinates to be clicked (while quicksetting tiles are on screen - up and down arrow button for mobiledata) and change the coordinates with yours.
description: (above part of flow sets mobile data off, if it's enabled)
Init Variable System Setting : it gets value of global variable "mobile_data1" and stores into variable varm
Expression : varm==1; (mobile data on?)
ControlUI: quickSettings();sleep(1000);click(540,513);sleep(1000);
(opens quick settings, waits for a second and clicks the position of mobiledata up down arrows - another one second)
NOTE: someone might ask, what about directly writing 0/1 into global "mobile_data1"? i tried and it didn't work.
device spec: Lenovo K5 Note - Android 6 - no root
this part of flow needs screen on to operate!
first and essential step: you need to dump global variables to two files and compare, like this: (of course adb shell needed and connecting phone to pc with usb debugging on)
make sure mobiledata is on, from pc adb folder:
adb shell settings list global > on.txt
turn off mobiledata from phone normal way and then second command:
adb shell settings list global > off.txt
2 files created. now time to compare these txt files with file compare programs.
my phone, this variable changes only:
mobile_data1 (can be 0 or 1 --- that variable will be used to detect mobiledata state)
and setup a flow like that as shown below, and last step, with trial and error method, find the XY coordinates to be clicked (while quicksetting tiles are on screen - up and down arrow button for mobiledata) and change the coordinates with yours.
description: (above part of flow sets mobile data off, if it's enabled)
Init Variable System Setting : it gets value of global variable "mobile_data1" and stores into variable varm
Expression : varm==1; (mobile data on?)
ControlUI: quickSettings();sleep(1000);click(540,513);sleep(1000);
(opens quick settings, waits for a second and clicks the position of mobiledata up down arrows - another one second)
NOTE: someone might ask, what about directly writing 0/1 into global "mobile_data1"? i tried and it didn't work.