mobile data on problem

420

Active member
i recently done the ADB hack thing and added the mobile data off/on to my "arrive/leave home" macro, my problem is that there is no internet after mobile data is turned on.

the leave home part looks like this;

trigger; no data connection

actions;

disable wifi
mobile data on
some stopwatches and variables
HTTP get

everything works except for the HTTP get this always fails, i tried adding a pause action and a loop to keep trying every minute, i even tried a wait untill data available trigger but that never fired, there is just no internet.

the only way i found to "activate" the internet connection is opening the browser, it will say no connection for a second and then it will automatically reload and everything works fine.

i need something other then opening browser to "activate" the connection, because that doesn't work while my phone is in my pocket.

anyone know of another way to "activate" the connection in the background? maybe some intent i can use?
 

420

Active member
Try this order instead:

mobile data on
wait
disable Wi-Fi
ok thank you, i did it like this and it worked the first time, after that it stopped working again, i rebooted my phone and now this morning it worked again, i will see if it keeps working now,

i would still like another way to activate the connection though, because now there is a 1 minute delay before turning my smart home devices off, which is still alot better then having to run the http get manually, but it will add up to alot when im leaving home atleast 3 times a day.

i just don't understand why the browser is able to activate the connection while macrodroid can't, if i untick the box on the http get action so it opens in browser i can put it right after the turn wifi off and mobile data on actions, and it will work fine without any wait action in between, (aslong as my phone is unlocked). is there really no intent that simulates whatever the browser is doing?
 

dhj49er

Well-known member
The mobile data on/0ff action only works properly on earlier versions of Android. On later versions, Google decided to prevent any app from controlling mobile data when WiFi is disabled or disconnected.

So what should be simple isn't allowed - blame Google.

However, there is another way to control mobile data, via a system setting - see attached screenshot for turning on mobile data - that works on some phones but not all. If it works on your phone, mobile data can be controlled when WiFi is disabled or disconnected.

So it's worth trying as it makes it simple again!
 

Attachments

  • Screenshot_20210427-164451_MacroDroid.jpg
    Screenshot_20210427-164451_MacroDroid.jpg
    37.8 KB · Views: 81

dhj49er

Well-known member
no meu dispositivo (galaxy note 10 plus com adb) mostra o mesmo erro mesmo tentando a solução do amigo acima :(
Tried translation but Google failed.
Are you saying it doesn't work on Galaxy note 10 +?
I have Galaxy S20 FE and it works.
I'd be surprised that it doesn't work on a Note 10.
I find using the system setting mobile_data 1 after WiFi disconnects, rather than disable wifi, works fine. Wait a short time and then disable wifi.
 

420

Active member
The mobile data on/0ff action only works properly on earlier versions of Android. On later versions, Google decided to prevent any app from controlling mobile data when WiFi is disabled or disconnected.

So what should be simple isn't allowed - blame Google.

However, there is another way to control mobile data, via a system setting - see attached screenshot for turning on mobile data - that works on some phones but not all. If it works on your phone, mobile data can be controlled when WiFi is disabled or disconnected.

So it's worth trying as it makes it simple again!
thank you for the suggestion, i tried it and the system log does say "sending request to helper file", but mobile data is not turned on or off.

so far what pseudocyclic suggested is working, with a 1 minute wait action, maybe i can try a shorter wait action and see if it'll still work, else i might just go back to leaving mobile data on 24/7.
 

Pseudocyclic

Well-known member
When I used to use this method it worked with a very short delay, less than a second I think, it certainly didn't need anything like a minute.
 

dhj49er

Well-known member
thank you for the suggestion, i tried it and the system log does say "sending request to helper file", but mobile data is not turned on or off.

so far what pseudocyclic suggested is working, with a 1 minute wait action, maybe i can try a shorter wait action and see if it'll still work, else i might just go back to leaving mobile data on 24/7.
The mobile data icon on the status bar does or does not change when you toggle system mobile_data setting?
 

420

Active member
When I used to use this method it worked with a very short delay, less than a second I think, it certainly didn't need anything like a minute.
i had already tried 10 seconds and that didn't work, thats why i tried with a minute, now i also tried with 1 second but that also did not work, i gues i will try 20 seconds now.
 

420

Active member
Are you sure you have the correct system setting?

I have had phones where it didn't turn mobile data on but it always changed the mobile data status bar icon.
i did: system setting - global (Root/ADB) - setting key: mobile_data - value: 1

i did not change the integer to float, long or string, should i pick one of those instead?

i also did not select anything from the "known keys (current value)", because i don't have a clue what that is about.
 

dhj49er

Well-known member
I think you must be doing something wrong.

The easiest way to select a key is using known keys.

Click on that opens a scrollable list of keys. Scroll down to the mobile_data key and select it. It will populate the action and allow you to put in a value, either 0 or 1. It's an integer.

Try that and see if the status bar icon changes or even better mobile data is turned on and off.
 

Attachments

  • Screenshot_20210428-163130_MacroDroid.jpg
    Screenshot_20210428-163130_MacroDroid.jpg
    210.6 KB · Views: 47
  • Like
Reactions: 420

420

Active member
I think you must be doing something wrong.

The easiest way to select a key is using known keys.

Click on that opens a scrollable list of keys. Scroll down to the mobile_data key and select it. It will populate the action and allow you to put in a value, either 0 or 1. It's an integer.

Try that and see if the status bar icon changes or even better mobile data is turned on and off.
thanks, found it, turns out i have to use the "mobile_data1" instead of just "mobile_data", also the "mobile_data2" doesn't work, but i gues thats for a second sim card then. thanks again, i will add it to my leave home macro and see if it'll work.
 

420

Active member
just to update; turning mobile data on through system setting results in the same problem. (it didn't even work with a 1 minute wait)

i am giving up on trying to make this work and will just go back to leaving mobile data on 24/7.

i appreciate you guys trying to help though, thanks!
 

Jacob L

Moderator (Lawsonator)
There is a setting in developer options called mobile data always on, if you find that in the system setting action you could toggle that instead
 

dhj49er

Well-known member
thanks, found it, turns out i have to use the "mobile_data1" instead of just "mobile_data", also the "mobile_data2" doesn't work, but i gues thats for a second sim card then. thanks again, i will add it to my leave home macro and see if it'll work.
I'm surprised you have to use mobile_data1.
Every instance I've seen in this forum uses mobile_data.
I have a dual SIM S20 FE & have all 3 keys. I use mobile_data in my macros and it works. I tried using mobile_data1 and found it didn't change the mobile data status bar icon and didn't control mobile data.
So I'm not surprised that mobile_data1 is not working for you.
The way I use it is as follows.
I have mobile data off when I'm at home, as I use WiFi.
On leaving home, WiFi disconnects, usually while the phone is off, and this triggers turning mobile data on using mobile_data key set to 1 followed by turning off WiFi.
When I turn on the phone a macro turns on WiFi and waits 15 secs before turning WiFi off if WiFi is not connected. If WiFi connects - on returning home for example - mobile data is turned off using the mobile_data key set to 0.
 

420

Active member
There is a setting in developer options called mobile data always on, if you find that in the system setting action you could toggle that instead
thank you for the suggestion, i tried that one aswell but nothing happens. (data is not turned on or off)
 

420

Active member
I'm surprised you have to use mobile_data1.
Every instance I've seen in this forum uses mobile_data.
I have a dual SIM S20 FE & have all 3 keys. I use mobile_data in my macros and it works. I tried using mobile_data1 and found it didn't change the mobile data status bar icon and didn't control mobile data.
So I'm not surprised that mobile_data1 is not working for you.
The way I use it is as follows.
I have mobile data off when I'm at home, as I use WiFi.
On leaving home, WiFi disconnects, usually while the phone is off, and this triggers turning mobile data on using mobile_data key set to 1 followed by turning off WiFi.
When I turn on the phone a macro turns on WiFi and waits 15 secs before turning WiFi off if WiFi is not connected. If WiFi connects - on returning home for example - mobile data is turned off using the mobile_data key set to 0.
setting mobile_data1 to 1 or 0 does work for me, data is turned on and off, but there will still be no internet connection after it is turned on. (same problem as with the "mobile data on" action)

thank you for the help, i learned some things, but i am giving up for now because it's doing my head in, maybe i will try it again later.
 
Top