Toggle between WiFi and mobile data with tasker - Xperia Z Themes and Apps

Hello. Does anyone knows how to make a script for tasker which switch mobile data off if WiFi is connected and mobile data back on if there's no WiFi connection? For the last 3 or 4 hours I'm searching for this and can't find nothing.
Also, I want if there's no WiFi network, to switch WiFi off (so mobile data will be turned on).
I managed to do something, but it didn't worked. When I enabled the profiles with WiFi and mobile data both turned on, the mobile data turned off, then WiFi off, then mobile data on and so on, in a loop.

Wouldn't that be redundant? The os already does that.
Sent from my Nexus 7 using Tapatalk

Thanks for the response. I know that if WiFi is connected, I'm using the internet from it, but mobile data is still active, right? Even if there's no traffic from mobile data, that's still on. Wouldn't that be a source of battery drain?

I set my data to turn off if my phone is connected for 5 minutes to a wifi. Important: set collision handling to 'abort existing task'.
Here you got pictures.
Edit:
if you are further interested in battery savings, you can read my thread "[BATTERY LIFE] How to get up to 7+h of screen-on-time"

This is absolutely redundant and unnecesary, when the phone connects to a wifi, it disables 3g/LTE data connection by itself. When you connect to a wifi you can see how the 3g/H/H+ icon above radio signal dissapears. The radio chip inside this phones can be used in Wifi mode or 3g/4g mode for data connection, but not both at a time. It is technically not possible.

Accidentally sent from my Xperia Z using Tapatalk

RoberM said:
This is absolutely redundant and unnecesary, when the phone connects to a wifi, it disables 3g/LTE data connection by itself. When you connect to a wifi you can see how the 3g/H/H+ icon above radio signal dissapears. The radio chip inside this phones can be used in Wifi mode or 3g/4g mode for data connection, but not both at a time. It is technically not possible.
Click to expand...
Click to collapse
The moment you don't have wifi anylonger, the phone starts a fullburst search for wifi and 3G/4G networks (even if I don't want wifi/data at the moment). and this drains a hell of a lot of battery. then (if you go out e.g.) it finds a 3g/4g-connection which it tries to keep up (drains a lot battery) and in the same time searches for wifi-networks (also drains battery)... very inefficient use of battery
So I deactivate data after 5 mins automatically via tasker and turn it on manually when I need it (could also automate that, but I'm lazy). This way I circumvent all these battery drains
Additionally:
Under normal circumstances I'd also set wifi to "turn off if not connected" (in settings) and "optimize wifi for battery life", but I use a custom stock kernel that has issues with these settings so I need to leave wifi on all day

sea2605 said:
The moment you don't have wifi anylonger, the phone starts a fullburst search for wifi and 3G/4G networks (even if I don't want wifi/data at the moment). and this drains a hell of a lot of battery. then (if you go out e.g.) it finds a 3g/4g-connection which it tries to keep up (drains a lot battery) and in the same time searches for wifi-networks (also drains battery)... very inefficient use of battery
So I deactivate data after 5 mins automatically via tasker and turn it on manually when I need it (could also automate that, but I'm lazy). This way I circumvent all these battery drains
Additionally:
Under normal circumstances I'd also set wifi to "turn off if not connected" (in settings) and "optimize wifi for battery life", but I use a custom stock kernel that has issues with these settings so I need to leave wifi on all day
Click to expand...
Click to collapse
Umm, ok... But this has nothing to do with what the OP asked, or what I said.

You may try e-robot from play store.
I have a command for that, after wifi disconnects, wait for 30 sec. If still wifi is not connected, automaticcaly disables wifi.
Same as for bluetooth. When i leave my phone in my desk and gone for a while, 60 sec later disable bt.
You can do what ever you want.
Sent from my C6603 using Tapatalk

Related

Data switching in G1

Hi. I've bought my first Android device, a HTC G1 Dream. I've gained root access, installed the last Cyanogen release (with Android 1.6), RA-1.2.3.
What I've noticed is a strange behavior, quite different from the one I had with my BlackBerry Bold.
When I'm home I enable wifi, to save some datas from my (limited) contract. It works and I've set not to disable wifi when in standby. It works. But as soon as I go out (and the wifi coverage finishes), it doesn't re-enable UMTS data until I awake it from the standby manually.
It's quite annoying...is there a way to change this kind of behavior?
Thank you very much!
Is it still connected to EDGE or GPRS? If this is the case it is a PowerSaving feature, if it's totally lost connection with the net then you have a problem I guess...
sturmeh said:
Is it still connected to EDGE or GPRS? If this is the case it is a PowerSaving feature, if it's totally lost connection with the net then you have a problem I guess...
Click to expand...
Click to collapse
When I connect via Wifi, it disconnects from edge, gprs or umts. And doesn't reconnect when the wifi coverage ends (unless I "re-awake" the phone,pushing the menu button)
from what i read your saying thats while its sleeping its not connecting to your data services when your leaving wifi coverage, so my question is: do you not see the data icon when you wake up the phone but after waking it it comes on or are u assuming that its not on?
stefan.buddle said:
from what i read your saying thats while its sleeping its not connecting to your data services when your leaving wifi coverage, so my question is: do you not see the data icon when you wake up the phone but after waking it it comes on or are u assuming that its not on?
Click to expand...
Click to collapse
Yes, I cannot see the icon as soon as I wake up it. Then, in some seconds, it reconnects. More, I can see it's not just a "icon" issue because my K9-mail stops collecting my mailboxes when that situation happen.

[Q] Wifi and Data disconnecting during deep sleep

My HTC Butterfly S has been disconnecting from wifi whenever i leave it alone for some time (10~20mins). Whenever i on the screen after such times, i realise that there is ABSOLUTELY no data or wifi connection (only the signal bars icon are in the status bar) and 1 or 2 seconds later, LTE reconnected and then wifi reconnected 1~2 secs later itself too.
I tried sending links from chrome to my phone (using sendtab) during this period and the phone does not receive any notifications, thus confirming the fact that there is no internet connection whenever the phone is in deep sleep.
Oh and 1 more thing : this only happens when wifi is connected, if wifi isnt connected when the phone goes into deep sleep, there is still LTE connection. When wifi is connected and the phone goes into deep sleep, the phone does not default back to LTE or 3g, all forms of connection with the internet are gone, only leaving the cellular connection available.
Anyone having the same problems? Btw phone is bootloader unlocked and rooted, using stock rom.
fanghan said:
My HTC Butterfly S has been disconnecting from wifi whenever i leave it alone for some time (10~20mins). Whenever i on the screen after such times, i realise that there is ABSOLUTELY no data or wifi connection (only the signal bars icon are in the status bar) and 1 or 2 seconds later, LTE reconnected and then wifi reconnected 1~2 secs later itself too.
I tried sending links from chrome to my phone (using sendtab) during this period and the phone does not receive any notifications, thus confirming the fact that there is no internet connection whenever the phone is in deep sleep.
Oh and 1 more thing : this only happens when wifi is connected, if wifi isnt connected when the phone goes into deep sleep, there is still LTE connection. When wifi is connected and the phone goes into deep sleep, the phone does not default back to LTE or 3g, all forms of connection with the internet are gone, only leaving the cellular connection available.
Anyone having the same problems? Btw phone is bootloader unlocked and rooted, using stock rom.
Click to expand...
Click to collapse
Check and make sure your power saving mode isn't on
Sent from my HTC Butterfly using XDA Premium 4 mobile app
Nope it's not on, and wifi is also set to always on during sleep.
Probably it's how the Rom is built to save battery
Sent from my HTC Butterfly using XDA Premium 4 mobile app
Actually, I don't think that power saving mode disables the connection, but sleep mode, that is enabled on my phone in Power option. From description it disables any data transfer during deep sleep. I have MaximusHD rom, can't tell if that option is shown on stock.
Try disabling this option :
WIFI > Advanced > Wifi optimization
This option might be the cause. Also, you might want to tick the Best Wifi Performance to test.
It's natural for android to silently disable data when you're on wifi. It only makes sense to do that.

Cellular data being used instead of WIFI - ! shown with wifi icon

Can be connected to wifi, but for some reason the phone thinks the wifi connection is bad/poor, and then it will use cellular data (there will be an ! in the wifi)
This is VERY VERY VERY VERY VERY bad for me because I use a LIMITED CELLULAR DATA plan - and this phone decides on its own to not use what is really usable wifi. I have only had the phone 2 days and it is doing it repeatedly - did it at a hotel (which required username/password) but then every single time I leave the hotel and return, it connects to the wifi, but uses cellular data. If I turn off cellular data [I use Power Toggles app to make it easy], the wifi suddenly becomes acceptable to lollipop and the exclamation mark disappears from the wifi icon and I have internet access (no sign in required as the network remembers my mac id/authorized me for at least 24 hours) - and then I can toggle cellular data back on and it will stay on wifi - UNTIL I leave and return again when it starts all over again.
Similarly, at my home where I have strong wifi - sometimes it just decides not to use it. So, when I look at my phone and see the wifi with ! I have to do the same thing - disable cell data to get it to use the wifi.
This is ridiculous!
This switchover to cell data should at minimum be a user-configurable option. I do not want it doing this!
relaxable said:
Can be connected to wifi, but for some reason the phone thinks the wifi connection is bad/poor, and then it will use cellular data (there will be an ! in the wifi)
This is VERY VERY VERY VERY VERY bad for me because I use a LIMITED CELLULAR DATA plan - and this phone decides on its own to not use what is really usable wifi. I have only had the phone 2 days and it is doing it repeatedly - did it at a hotel (which required username/password) but then every single time I leave the hotel and return, it connects to the wifi, but uses cellular data. If I turn off cellular data [I use Power Toggles app to make it easy], the wifi suddenly becomes acceptable to lollipop and the exclamation mark disappears from the wifi icon and I have internet access (no sign in required as the network remembers my mac id/authorized me for at least 24 hours) - and then I can toggle cellular data back on and it will stay on wifi - UNTIL I leave and return again when it starts all over again.
Similarly, at my home where I have strong wifi - sometimes it just decides not to use it. So, when I look at my phone and see the wifi with ! I have to do the same thing - disable cell data to get it to use the wifi.
This is ridiculous!
This switchover to cell data should at minimum be a user-configurable option. I do not want it doing this!
Click to expand...
Click to collapse
go into the main phone settings, wifi, three dots at the top right, advanced, now disable scanning always available
simms22 said:
go into the main phone settings, wifi, three dots at the top right, advanced, now disable scanning always available
Click to expand...
Click to collapse
Already was disabled. (That was the option I chose when I set the phone up).

adaptive wifi

I have it enabled and it says it auto turns off WiFi and back on when near used wifi locations but it doesn't do that at all. Does it simplyeave WiFi on but low energy?
Screenshot l
Yeah it works.
How do you know it doesn't do it? Cellular phones hand off betwixt cellular and wifi all the time.
When and how often it does is based on some under the hood shenanigans that we dont know about.
marctronixx said:
How do you know it doesn't do it? Cellular phones hand off betwixt cellular and wifi all the time.
When and how often it does is based on some under the hood shenanigans that we dont know about.
Click to expand...
Click to collapse
I drive away from my house. WiFi stays on but not connected. Screenshot says wifi will turn on when near known connections but it never turns off ?
masri1987 said:
I drive away from my house. WiFi stays on but not connected. Screenshot says wifi will turn on when near known connections but it never turns off ?
Click to expand...
Click to collapse
I don't think it's supposed to turn off. What that phrase means is that it will connect to WiFi when it's near a saved access point and will use mobile data when none are nearby, but WiFi will still remain on.
What adaptive WiFi does is it will use mobile data even if it's connected to a WiFi access point if the WiFi signal is bad.
I'm not sure what adaptive wifi supposed to do, I have it off and it switches between wifi and cell as it should. Is it switching in the middle of data transfer or something? Because right now I probably drop connection if move outside wifi range and will be on cell tower on the next redial. But to tell truth I never tested it.
So basically it's a gimmick, because Wifi as it is, will auto-connect to previously connected networks as long as you had wifi on. If i'm interpreting the screenshot properly the feature "turns on" wifi, therefore, it must be able to turn it off? I've even manually turned it off to see if it will turn itself back on when i get back home and nothing either.
No documentation on Samsung's site as far as i can find
masri1987 said:
So basically it's a gimmick, because Wifi as it is, will auto-connect to previously connected networks as long as you had wifi on. If i'm interpreting the screenshot properly the feature "turns on" wifi, therefore, it must be able to turn it off? I've even manually turned it off to see if it will turn itself back on when i get back home and nothing either.
No documentation on Samsung's site as far as i can find
Click to expand...
Click to collapse
Basically if you're connected to WiFi but have crappy signal like .2 kbps, it will start using your mobile data even if you're still connected to that WiFi. With adaptive WiFi turned off, it will keep using the crappy WiFi connection until you manually turn WiFi off or manually disconnect from the crappy network. Pretty much the reverse of WiFi calling (use WiFi if phone signal is crappy). Note the exceptions sentence at the bottom, it will not use mobile data even if the WiFi has a crappy signal if the crappy WiFi is exempted.
The "turn on" statement is correct, it will automatically turn on and connect to WiFi when it's in range of "trusted" access points (similar to "trusted devices" and "trusted places") but there is no automatic "turn off", at least, it hasn't done that while I've been using it.
OK i see what you are saying
wifi does not PHYSICALLY TURN OFF. wifi is still connected--the phone will auto switch to the stronger of the two. it won't turn the on screen "switch" off if that is what you are looking for.
its not a gimmick. it works if you are in an area with robust wifi and/or cellular. its supposed to work "in the background" so you don't know its going on.
google fi kinda does this. since google fi uses tmobile and sprint, the phone auto switches between the two carriers depending on which is stronger at the time. i've seen this happen by monitoring an app.
masri1987 said:
So basically it's a gimmick, because Wifi as it is, will auto-connect to previously connected networks as long as you had wifi on. If i'm interpreting the screenshot properly the feature "turns on" wifi, therefore, it must be able to turn it off? I've even manually turned it off to see if it will turn itself back on when i get back home and nothing either.
No documentation on Samsung's site as far as i can find
Click to expand...
Click to collapse
Not a gimmick at all. I work at a hospital that has wireless routers throughout that all piggy back the same access point. I see Adaptive wifi in action all day. Keeps me from losing my connectivity from my work portal.
don't think I want to have this on: I have limit on my cell data, let's say I start downloading something large, let's say 5- 10 GB movie from Amazon on wifi, then I go to my upstairs bedroom, wifi gets weaker, so it switches itself to stronger cell tower and eats my whole month data allotment in one evening, before I even notice? And all I had to do is keep the phone downstairs, next to the router to avoid it. Or am I missing something?
harveydent said:
Basically if you're connected to WiFi but have crappy signal like .2 kbps, it will start using your mobile data even if you're still connected to that WiFi. With adaptive WiFi turned off, it will keep using the crappy WiFi connection until you manually turn WiFi off or manually disconnect from the crappy network. Pretty much the reverse of WiFi calling (use WiFi if phone signal is crappy). Note the exceptions sentence at the bottom, it will not use mobile data even if the WiFi has a crappy signal if the crappy WiFi is exempted.
The "turn on" statement is correct, it will automatically turn on and connect to WiFi when it's in range of "trusted" access points (similar to "trusted devices" and "trusted places") but there is no automatic "turn off", at least, it hasn't done that while I've been using it.
Click to expand...
Click to collapse
Exactly what happens to me when I leave home. My phone (old Note 7) will stay connected to my home network but won't be able to pull down any data from the net. It has to be manually turned off.
Sent from my SM-N950U using XDA-Developers Legacy app
thanks for the education!!
Any 3rd party apps you can recommend that would do what i am looking for?
so an update. It work exactly how it says it would. I had to drive 7 miles out, but wifi automatically turned off, even with scanning off, once i got home it turned back on.
I like it. It works great for me.
masri1987 said:
so an update. It work exactly how it says it would. I had to drive 7 miles out, but wifi automatically turned off, even with scanning off, once i got home it turned back on.
Click to expand...
Click to collapse
Ah, that's the thing. I noticed my WiFi would automatically turn off sometimes and sometimes not, and I couldn't reproduce it reliably. It's most likely either distance or time you have to be away from the "trusted" access point.
Congrats, now you can forget about toggling WiFi forever!
I think this setting has been screwing with my wifi related Tasker profiles. Suspect it really does turn wifi off.
I used to switch my wifi off manually when leaving the house.
All this #[email protected]\%! public wifi, blocking my internet because asking to log in....
Any shop or restaurant where you walk in does it.
And you do not know it, till you search the web and see that there is no internet at all till you switch your wifi off or log in to the shops fishing routers.
Adaptive wifi is a must have and a great improvement.
E.g. walk in a MacDonald's with adaptive switched on or off, you will see it is mother's little helper.
You need to have enough data from your provider of course.
Huib
masri1987 said:
thanks for the education!!
Any 3rd party apps you can recommend that would do what i am looking for?
Click to expand...
Click to collapse
Ifttt on Google play store
marctronixx said:
How do you know it doesn't do it? Cellular phones hand off betwixt cellular and wifi all the time.
When and how often it does is based on some under the hood shenanigans that we dont know about.
Click to expand...
Click to collapse
Now that is some sweet use of the English language!

Question Wifi <-> Mobile switching?

I have this strange issue that has been with me almost since the beginning. I haven't been able to trace when it happens, but it now seems almost 100% of the time.
I only have WiFi in the house (wifi6, if it matters). If I go out, I only have 4G (I left only 4G and disabled 5G). I have no data until I put the phone into airplane mode and back, or I disable and re-enable mobile data.
Same thing when I go back in the house: no data until I disable and re-enable WiFi.
I've disabled the option for 'always-on mobile data' or similar, it's quite a battery drain if there's no cell signal.
Seems like a very strange bug, I don't have this with any of my other phones.
So you have both WiFi and 4G enabled and they don't switch seamlessly?
Exactly. I always have to restart each one of them, usually by toggling airplane mode. Was wondering if anyone else ran into this issue.
Ok this really is strange. There are 2(!) different toggles to enable data switching between WiFi and 4G, but for me it works flawlessly without them! As soon as I get out of my home WiFi range, 4G kicks in, and when I get in range again, the phone connects to my WiFi...
Hi, i have this problem too but it's not always.
I have a wifi 6 router too.
I also have problems switching from wifi to 4g. Need to toggle airplane mode on/off. 5g deactivated. No wifi 6 here.
I always assumed my vpn is causing problems during the switch to 4g. But hearing others have the same problem i would assume its zenfone problem.
I never had any issues in this area with my ZF8. With the option to have cellular always on I could walk out of my WiFi zone during a video call and no drop or short pause would appear.
With this off the network need a few second to work, and some apps need to be refreshed/restarted to gain connection. Never needed to toggle connection for this to work.
Maybe a reset would be enough or check for updates.
Ah, exactly! It does not necesarily need a network restart, but some apps just lose connection for a while, which can be from a few seconds to >1h. Which is even more weird as the icons are showing full connectivity. I would go out of the house, do stuff, come back later and I would only get the notifications when I'm back inside the house.
Rarely I had the connection drop completely (no signal) when switching, but I haven't noticed this happening since the last update.

Categories

Resources