Wifi and mobile data toggle doesn't work

Moorhen

Member
I have a Pixel 6 running Android 13. I have several macros that contain the wifi toggle and mobile data toggle actions. I have executed the ADB hack to make the latter work. Despite this, I cannot get this to work anymore. On my previous phone (OP Nord) mobile data toggle worked flawlessly, on my Pixel 6 I haven't got it to work. The wifi toggle issue doesn't work most of the time (with some exceptions, although I cannot identify why it sometimes works and most of the time it doesn't).

Wifi
Despite the existence of a wifi toggle action in my macro, MD seems to ignore that action oftentimes and only perform the other actions in that macro. In the log I can see that the action fired, but in practice the result is 0 (i.e. no toggling).

Mobile data
The mobile data seems to work to the extent that it really toggles the mobile data switch in my notification panel. I can visually see that it is toggled from left to right or vice versa. But also here there effect is 0. E.g. when mobile data is on and this action is fired, the toggle switches to 'disabled', but I can still see the 4G logo in my notification bar and I still have access to the internet (with wifi disabled).

Any suggestions?
 

MacroDroidDev

Administrator
Staff member
With regards to wifi please check the following:

1) You have location services enabled on your device.
2) You have granted location permission to the MacroDroid helper app.
3) You have disabled battery optimization for the MacroDroid helper app.

Point 3 is critical even thought it doesn't appear so.

Unfortunately mobile data via ADB does not work reliably on all devices and this is described in the app. The only way to be sure it will work is to have a rooted device.
 

dhj49er

Active member
I have had several phones that behave the way you describe. I used to think it was Google implementing restrictions in Android. However, after several phones from different manufacturers, all running either Android 11 or 12, I have had differences in MD control of WiFi and Mobile Data. In all cases one or both didn't work. However, I now have a Realme GT Neo 2 running Android 12 and I was pleasantly surprised to find that MD can control WiFi, Mobile Data & Bluetooth.
So it would appear that phone manufactures can elect to follow Google or not.
In your situation I would recommend trying ADB shell as that has worked for me on all my previous phones. Search this forum and you should find details of ADB shell, if you are not familiar with it.
 

Moorhen

Member
I have had several phones that behave the way you describe. I used to think it was Google implementing restrictions in Android. However, after several phones from different manufacturers, all running either Android 11 or 12, I have had differences in MD control of WiFi and Mobile Data. In all cases one or both didn't work. However, I now have a Realme GT Neo 2 running Android 12 and I was pleasantly surprised to find that MD can control WiFi, Mobile Data & Bluetooth.
So it would appear that phone manufactures can elect to follow Google or not.
In your situation I would recommend trying ADB shell as that has worked for me on all my previous phones. Search this forum and you should find details of ADB shell, if you are not familiar with it.
Hahaha, I just replied to an old post of you in another thread. I have to try to figure out how to use ADB Shell.
 

Dimlos

Active member
We have confirmed the operation on Android 13 Pixel 5a, and have attached the macro by ADB Shell [Tasker Plugin], so please try one action at a time.

You need to install ADB Shell [Tasker Plugin], after installing the plugin, the following command is required.

USB connection of the Android device to PC and adb command to put the ADB daemon into TCP/IP connection mode is required.

adb tcpip 5555

This command is valid until the Android device is rebooted.
 

Attachments

  • wifi_and_mobile_data_toggle.jpg
    wifi_and_mobile_data_toggle.jpg
    261.2 KB · Views: 11
  • wifi_and_mobile_data_toggle.macro
    9.2 KB · Views: 8

Moorhen

Member
We have confirmed the operation on Android 13 Pixel 5a, and have attached the macro by ADB Shell [Tasker Plugin], so please try one action at a time.

You need to install ADB Shell [Tasker Plugin], after installing the plugin, the following command is required.

USB connection of the Android device to PC and adb command to put the ADB daemon into TCP/IP connection mode is required.

adb tcpip 5555

This command is valid until the Android device is rebooted.
Thanks! So this means that I have to make a usb connection and run the command every time I have rebooted the device? If that is the case, the benefits of this workaround do not outweigh the hassle that it will give me at every reboot.
 

Dimlos

Active member
Could you try to see if it works first?
The adb tcpip 5555 command can also be sent from your terminal via wireless debugging without connecting to a PC.
 

Moorhen

Member
Could you try to see if it works first?
The adb tcpip 5555 command can also be sent from your terminal via wireless debugging without connecting to a PC.
Wireless debugging is less hassle indeed, but would still require an action from me upon each reboot right? If so, then I don't bother. But I do appreciate the suggestions you provided!
 

Endercraft

Well-known member
Wireless debugging is less hassle indeed, but would still require an action from me upon each reboot right? If so, then I don't bother. But I do appreciate the suggestions you provided!
Maybe you would be able to do it using UI Interaction and with some trigger for while you're not using your phone for a certain time.
 

dhj49er

Active member
Wireless debugging is less hassle indeed, but would still require an action from me upon each reboot right? If so, then I don't bother. But I do appreciate the suggestions you provided!
An alternative suggestion.....is to press the status bar icon via UI integration actions, but this only works with the screen on.
 

Moorhen

Member
Maybe you would be able to do it using UI Interaction and with some trigger for while you're not using your phone for a certain time.
Thanks, I tried that but that works only randomly. The thing is that accessing the mobile data toggle requires multiple gestures (i.e. pull down notification bar, click internet button and then switching the mobile data switch). Even with the 'wait for X seconds' action, sometimes the UI interaction is executed too quickly. I haven't been able to get this working correctly
 

Dimlos

Active member
Up to Android 12, I think I could automate adb tcpip 5555 in combination with Termux using the logcat trigger.

Android 13 seems not to work with logcat trigger at the moment, so manual operation is required.
 

Moorhen

Member
Up to Android 12, I think I could automate adb tcpip 5555 in combination with Termux using the logcat trigger.

Android 13 seems not to work with logcat trigger at the moment, so manual operation is required.
Too bad, but again: thanks for the support
 

Endercraft

Well-known member
Thanks, I tried that but that works only randomly. The thing is that accessing the mobile data toggle requires multiple gestures (i.e. pull down notification bar, click internet button and then switching the mobile data switch). Even with the 'wait for X seconds' action, sometimes the UI interaction is executed too quickly. I haven't been able to get this working correctly
Combine with screen content, add expand bar status, some other actions, some constraints and almost everything is possible ! You just have to do it right.
 
Top