Set an app's data usage to mobile data upon Wifi-connection

638 views
Skip to first unread message

Frosty

unread,
Jan 29, 2020, 2:13:30 PM1/29/20
to Tasker
I need a way to set a certain toggle within the UI of my Galaxy S10+, no root.

I connect my phone wirelessly to use Android Auto.
Doing so will render most apps useless, since the Wifi only serves to connect to the headunit of my car, not actually going online, so Spotify and other apps lose (part of) their function(s).

My phone offers a toggle to set apps to "Always use mobile data", even when connected to Wifi.

For some apps, this is alright, for others, it's somewhat tedious to either "waste" mobile data on them or always manually set the toggle.

I guess what I'd like to do is the following:

When connected to [Car Wifi]
Set toggle [Always Use Mobile Data] to [Active] for specific Apps
When disconnected from [Car Wifi] revert/disable toggle


I hope I could make myself somewhat clear.
No idea if my problem can be solved with tasker (without root), any input or alternative solutions are appreciated.

Robert Ryan

unread,
Jan 29, 2020, 2:41:42 PM1/29/20
to tas...@googlegroups.com
You can use the Custom Setting action for this. Be sure to read the help for this action. There is some setup required. 

        Test
        
        Abort Existing Task
        
    A1: Custom Setting 
        Type: Global 
        Name: mobile_data_always_on 
        Value: =:=toggle=:= 
        Use Root: Off 

Set value to 1 to turn it on, 0 to turn it off, =:=toggle=:= to toggle it. 

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tasker/8822facf-72e5-4f76-85b1-5751732309c7%40googlegroups.com.

Frosty

unread,
Jan 29, 2020, 5:41:47 PM1/29/20
to Tasker
Thanks for the reply.

I can't check the routine right now, but I got it set up as you mentioned.

However, I probably didn't make myself clear.
I assume the above will simply toggle mobile data on/off.
I always have mobile data and wifi turned on, since usually the "fallback" to mobile data only happens when I am way out of reach of my office/home-wifi...

What I actually need is a setting for particular apps (for example Spotify) to only use mobile data.
It seems that apps try to use and prefer the wifi-connection over mobile data, and since the wifi is, as I said, technically "offline", no data gets transferred.
The apps/phone/OS seems to have a somewhat low threshold at which it will prefer mobile data over a bad wifi-connection.

My phone has a sub-menu (not quite sure of the path, it's somewhere around "settings-wifi and mobile data-advanced-set apps to always/only use mobile data" (currently set for Spotify, a few messenger apps, Google Maps....)
From this menu, I can toggle all apps to only use, well, mobile data, even when I'm connected to my home or any other stable wifi.

So, maybe I misunderstood your reply or missed something - I'm far from being a power user - or I didn't make myself clear.

Alternatively, would there be a possibility to go along something like this:

If [Android Auto] is running
Force all other apps to use mobile data and ignore wifi

?

Either way, thanks for the swift response.


To unsubscribe from this group and stop receiving emails from it, send an email to tas...@googlegroups.com.

Marta Hintz

unread,
Jan 29, 2020, 5:55:27 PM1/29/20
to Tasker
use custom settings (set it up first as stated in the help for that action)

then find the setting you want changed

Then see if Tasker can find the setting You changed.

Frosty

unread,
Jan 30, 2020, 1:20:00 AM1/30/20
to Tasker
Got it set up as you guys (and the info) says.

However, the toggle is not found when I use the "find" function.

Using Samsung's OneUI, the toggle is found @ Settings - Connections - Data Usage - Apps which only use mobile data (rough translation from German)
Is there a way to "simulate" that navigation upon starting Android Auto, for example, or when connected to the car's wifi?

Again, sorry for the inaccuracies on my end, but I am that versed in these things it seems....

Marta Hintz

unread,
Jan 30, 2020, 5:38:32 PM1/30/20
to Tasker
just tried it on my note 9 ONEUI and custom settings could not see the change, so unfortunately looks like only autoinput may be the answer.  This requires Autoinput to navigate to the screen and toggle the switch for you.  It's a bit tricky to set up but doable .
Marta

Frosty

unread,
Jan 31, 2020, 1:57:52 AM1/31/20
to Tasker
Ok, got myself Autoinput. I get the basic idea, but I seem to fail to select the correct field/switch.

When I create a new "action", I use the Pop-Up to navigate to the settings menu, select the toggle (or the field in which the toggle is located) and click "Add" on the notification.
It seems to register the correct field and text, but when I tried the action with a simple task (start youtube -> toggle switch), I get an error; I assume it registers the wrong field/switch/class/id or something.

Is there a way to view the exact name/ID/whatever of that switch, maybe some overlay in Android's developer options?

Alan Burnstine

unread,
Jan 31, 2020, 6:21:11 AM1/31/20
to Tasker
Struggling with a similar issue. I haven't tried autoinput to solve it yet, but I would suggest setting up each of the apps you need, and have autoinput just toggle the feature itself rather than each of the apps. Easier to find the click spot and faster so less likely to have issues.

Frosty

unread,
Jan 31, 2020, 6:46:52 AM1/31/20
to Tasker
I think I figured it out.

My profile is activated when Android Auto starts, which it does as soon as it's connected to my car. I set up a task with the following steps:
1) Start "Settings"-app
2) Use AutoInput (with the assistant) to navigate to "Connections"
3) Use AI to navigate to "Mobile Data"

Here is where I got confused.
There is an option "Apps which only use mobile data". It has a toggle at the end that de-/activates the "mobile data only"-option.
I can also click the whole "line" which brings me to a sub-menu which has the same de-/activate-toggle at the top, as well as separate entries for all apps which shall be active once the "main toggle" is active.

I could not get the "main toggle" at the top to work, but eventually managed to select the one I get to after 3).
Now I gotta check if this works without any timeouts and while the screen is locked, as well as a proper exit-condition.

Again, I'm sorry for this somewhat confusing/confused questions and replies, but the different toggle-behaviour really got to me.

Thanks for all your input 

Jimmy Jimmy

unread,
Jan 31, 2020, 9:14:37 AM1/31/20
to Tasker
Another idea is, if you want a particular app to use mobile data only, you can use an App context to detect the app and once detected, turn off WiFi. The vice versa.

Alan Burnstine

unread,
Jan 31, 2020, 9:25:20 AM1/31/20
to Tasker


On Friday, January 31, 2020 at 9:14:37 AM UTC-5, Jimmy Jimmy wrote:
Another idea is, if you want a particular app to use mobile data only, you can use an App context to detect the app and once detected, turn off WiFi. The vice versa.

This works for my use case, which is that some apps don't work behind the firewall on my work WiFi network, and in fact is the only solution because the RING app that is the main one I am interested in also can not be enabled in the Mobile Data Only settings.  However, the OP is using WiFi to connect to his Android Auto head unit, so disabling WiFi to use an Internet App would disconnect him from the head unit, so that won't work.  It seems to me this is a major flaw in wireless connection for Android Auto's design. 

Frosty

unread,
Jan 31, 2020, 12:47:42 PM1/31/20
to Tasker
It truly is an interesting design choice. However, I feel the real issue is the threshold when data transfer falls back on mobile data. It seems that as long as there is any Wi-Fi connection, Android will try to use that over mobile data, even when there is obviously only a minimum of bandwidth...

Btt: it seems my routine needs a lot of tweaking, right now I'm stuck in some loop which I can only exit when frantically switching between 'last used', Tasker and Android Auto to close them all.

Reply all
Reply to author
Forward
0 new messages