Mobile network state toggle- ADB hack

Post your questions and help other users.

Moderator: Martin

Post Reply
icefox56
Posts: 53
Joined: 15 Aug 2017 02:56

Mobile network state toggle- ADB hack

Post by icefox56 » 28 Jul 2020 05:08

Can I toggle the "Mobile network state" in version 1.37 without root?

I saw tasker allows to do this using ADB hack.
If yes, what is the adb command for this.
If no, do you know any other app (possibly free) that can do this, (not tasker)
Asus Zenfone Max pro M1, Stock android, Oreo 8.1, Rooted

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Mobile network state toggle- ADB hack

Post by Desmanto » 28 Jul 2020 10:26

We can do this already using Set System Setting.
[global] mobile_data1 : 0 >>> 1

The key can be different in yours, you can find it using my secure logger. viewtopic.php?f=3&t=7931

This reminds me that I haven't share my new secure setting logger flow. I almost forgot it due to many things to do in the office.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

icefox56
Posts: 53
Joined: 15 Aug 2017 02:56

Re: Mobile network state toggle- ADB hack

Post by icefox56 » 28 Jul 2020 16:39

Thanks for the reply Desmanto.

I downloaded your secure settings flow and changed mobile_data 1 to 0, but there was only visual change. i.e the 4G icon indicating mobile data was on disappeared. But the data send and received arrows were still working so was internet. I was able to load web pages (I tried multiple websites). Then I turned the screen off and on to see if it made any change, but no luck it was still the same.

My phone runs on stock android. I have unrooted my phone long ago. what should I do now? Any workaround?
Asus Zenfone Max pro M1, Stock android, Oreo 8.1, Rooted

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Mobile network state toggle- ADB hack

Post by Desmanto » 28 Jul 2020 17:25

Hmmm, zenfone pro M1 should be very close to stock. The method above works for my RN5 whyred with AEX Pie 9.0 ROM. I have root though, maybe the setting the global category is invoked using root rights.

Tasker method probably using adb shell

Code: Select all

svc data enable
Without adb or dump permission, only execute root command can execute this. Maybe some other user who are using AM 1.38 EAP (and already grant DUMP permission to Automagic) can help test this whether this method work.

Last resort is to use Control UI to tap toggle the mobile data, but it has UI distraction.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

icefox56
Posts: 53
Joined: 15 Aug 2017 02:56

Re: Mobile network state toggle- ADB hack

Post by icefox56 » 29 Jul 2020 01:48

Control UI is not an option for me, I want to turn off data when screen has been off for 15 minutes.

Any idea when v1.38 is coming out?
I'm currently using macrodroid for turning off mobile data. I gave it WRITE_SECURE_SETTINGS permission and it works.
How come it does not work on automagic, it also have the same permission given?

Edit: Apparently Macrodroid isn't working also. It's just visual change.
But Tasker works. They use a code like

Code: Select all

adb tcpip 5555
Asus Zenfone Max pro M1, Stock android, Oreo 8.1, Rooted

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Mobile network state toggle- ADB hack

Post by Desmanto » 29 Jul 2020 11:21

I just recheck, tasker use adb client to connect to the adb wifi. Your command above is to change the adb from USB to wifi adb. After that, any toggling command use the same svc based command (just like I posted above).

This require computer to invoke the command at every reboot. Only android 11 above can have this toggle without root/adb from computer. (of course, not yet released)

So far, AM 1.38 EAP also doesn't have separate adb client to connect to its own adb wifi. I am trying to find a working binary to use this adb client, but still can't find it.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply