How to turn on/off wifi hotspot on bluetooth connect/disconnect - Tasker Tips & Tricks

Hi All,
I'm new to Tasker but reading around various forums, it seems it will do what I need, just not sure HOW and I'm hoping someone here can help?!
I have an Android car radio and a Nexus 6P. I want to be able to setup a task/profile so that when my phone pairs to the headunit via bluetooth at power on, it turns the phone WiFi off and the WiFi hotspot on. Then when the car is turned off and bluetooth disconnects, it will turn off my phone hotspot and turn my phone WiFi back on.
I'm sure it's fairly simple for someone who knows what they are doing, any assistance would be much appreciated!

I have this set up with a profile like so:
State=bluetooth connected, 'CAR KIT'
--->task 'CarTether' (WiFi Tether=Set On)
<---exit task 'CarTetherExit' (WiFi Set On)
I have another profile that turns off bluetooth after 1 minute if it's not connected, thats what triggers the exit task (since it's no longer connected to 'CAR KIT' when I turn off the car). AFAIK when you turn hotspot on your phone will turn off wifi on its own, but you need to turn it back on (hence the exit task), and when wifi turns back on the hotspot should turn off.

Andromeda_Station said:
I have this set up with a profile like so:
State=bluetooth connected, 'CAR KIT'
--->task 'CarTether' (WiFi Tether=Set On)
<---exit task 'CarTetherExit' (WiFi Set On)
I have another profile that turns off bluetooth after 1 minute if it's not connected, thats what triggers the exit task (since it's no longer connected to 'CAR KIT' when I turn off the car). AFAIK when you turn hotspot on your phone will turn off wifi on its own, but you need to turn it back on (hence the exit task), and when wifi turns back on the hotspot should turn off.
Click to expand...
Click to collapse
Thanks for the advice, I've managed to setup a tasker profile that turns on wifi hotspot when Bluetooth connects and turns on wifi when it disconnects. The task works well, except that when the hotspot turns on, the radio won't connect, it gets stuck on obtaining IP address and Los to connecting, obtaining IP address but never connects. If I manually turn hotspot off and on again with the quick menu toggle it connects straight away. Any thoughts?
Sent from my Nexus 6P using Tapatalk

glenb83 said:
The task works well, except that when the hotspot turns on, the radio won't connect, it gets stuck on obtaining IP address and Los to connecting, obtaining IP address but never connects
Click to expand...
Click to collapse
Hrmm...I've not come across that one. If I had to guess, maybe one is trying to do something before the other is totally ready? The only thing I can think to try is experiment with a 1 or 2 second delay in different places, like a 'wait 1 sec' in between the bluetooth connecting and the hotspot turning on

Andromeda_Station said:
Hrmm...I've not come across that one. If I had to guess, maybe one is trying to do something before the other is totally ready? The only thing I can think to try is experiment with a 1 or 2 second delay in different places, like a 'wait 1 sec' in between the bluetooth connecting and the hotspot turning on
Click to expand...
Click to collapse
That sounds like a good plan, I'm not sure how to add in a delay though? If I edit the task of turning on the hotspot I get the option of adding an if variable, but not sure how to put in a delay...
Sent from my Nexus 6P using Tapatalk

glenb83 said:
That sounds like a good plan, I'm not sure how to add in a delay though? If I edit the task of turning on the hotspot I get the option of adding an if variable, but not sure how to put in a delay...
Click to expand...
Click to collapse
Action > Task > Wait

What Vagelis said^
Once the 'wait' is in your task you can 'grab' it by the right edge of the screen and drag it up or down, wherever you need it.

i looks like tasker does something wierd in Android 10, this worked always in Android 8 or 9 but now it doesnt.
when i get connected with my radio tasker turns on Tether but never turns is off when i disconnect bluetooth from my car.
can someone help me out tho think about a sulotion?

Mark ter Grote said:
i looks like tasker does something wierd in Android 10, this worked always in Android 8 or 9 but now it doesnt.
when i get connected with my radio tasker turns on Tether but never turns is off when i disconnect bluetooth from my car.
can someone help me out tho think about a sulotion?
Click to expand...
Click to collapse
Is the exit task actually running? What does the run log show?
This could be a device issue on A10 as well. If tasker is getting killed, it can't run. Take a look at https://dontkillmyapp.com/ for what ever device you have.
It also helps to post the description of your profile when asking for help. There is a sticky post in this forum with instructions.

Related

Online radio streaming on nexus stops with screen off.

Have you guys have the same problem?tryed all the radios on the market..they stream perfectly on wifi ,but when i lock the screen it just stops streaming.If i turn the screen back starts as normal.Any idea how to get over this?
No problem for me with lastFM.
This should work ... but it doesn't
Just in case you haven't tried - in the settings menu, Wireless and Networks, Wi-Fi settings, then press menu again and find 'Advanced'. Here lives 'Wi Fi sleep policy'. It looks promising, the obvious move is to set this to 'Never'.
But it doesn't solve the problem. Like you I'm finding that it is a problem with all radio streamers, some worse than others. If I turn wireless off and use 3G its fine.
Thanks for posting the issue. I thought I was the only one.
No problems with TuneWiki over WiFi and 3G...
i find that even if you set the wifi never to sleep it still does. i frequently use aftp to transfer movies and stuff to my phone over my lan, so ill set it to transfer like 3 gigs of stuff and go to bed, even though its set never to sleep the socket still gets closed at some point at night. so id say your problem lies with wifi sleeping.
also some online radios stop automatically after a certain amount of time incase you arent listening anymore to save bandwithd
Maybe its in the app settings. You didnt specify which app it was also...
This might help
When you connect Wi-Fi make sure to turn off your cellular network. N1 has this weird problem where in as soon as screen is off, it drops the wi-fi connection and goes on to cellular network.
So if you switch off ur cellular network it maintains its Wi-Fi connection even when the screen is off.
SiNJiN76 said:
Maybe its in the app settings. You didnt specify which app it was also...
Click to expand...
Click to collapse
i use mainly "AOnline radio" but i have tryed pretty much all from the market and all do the same. trying with the settings now..post if any change.
edit:yea still stops...strange try with gsm off and still same thing...is it there any solution to get over this thing?i just liten now with the screen on) eats the battery..it's ok but why not better?
The Nexus one activates some kind of energy saving mode as soon as you turn off the screen. This makes the WiFi connection very laggy, though stable for me. This is independent of the WiFi sleep policy. There's a bug report because of this for Sipdroid and I've also seen this issue while being connected to the phone via SSH. The connection is just fine as long as the screen is on, but if it's off, there's about 1 second delay.
However, I never had the problem you describe. Droidlive, for example, works just fine.
robert-qfh said:
The Nexus one activates some kind of energy saving mode as soon as you turn off the screen. This makes the WiFi connection very laggy, though stable for me. This is independent of the WiFi sleep policy. There's a bug report because of this for Sipdroid and I've also seen this issue while being connected to the phone via SSH. The connection is just fine as long as the screen is on, but if it's off, there's about 1 second delay.
However, I never had the problem you describe. Droidlive, for example, works just fine.
Click to expand...
Click to collapse
i will check droidlive myself right now...thank you for explinations..is there a way to talk with cyan and maybe he could overpass that wifi sleepy thing.
edit: also noticed if you ahve a download or something and turn the screen off goes very slow..so this problem i think really have a priority to be solved.
edit2:still stops...what would be the thing?wifi priority changed.do you have any type of settings?full app?
I'm listening to a ShoutCast stream with AOnline right now, using WiFi, screen is off. Works perfectly. Do you see this problem with other access points, too?
SLightworkaround....
If you can keep it plugged in...set the SCREEEN TO NEVER SLEEP...under settings>>>applications>>>DEVELOPMENT>>>STAY AWAKE... hope that helps!
robert-qfh said:
The Nexus one activates some kind of energy saving mode as soon as you turn off the screen. This makes the WiFi connection very laggy, though stable for me. This is independent of the WiFi sleep policy. There's a bug report because of this for Sipdroid and I've also seen this issue while being connected to the phone via SSH. The connection is just fine as long as the screen is on, but if it's off, there's about 1 second delay.
However, I never had the problem you describe. Droidlive, for example, works just fine.
Click to expand...
Click to collapse
This is the problem yes... Just try to ping your N1 while turning the screen off/on... Ping jumps up as soon as the screen is turned off...
For me Streams stop when I have a weak signal to begin with, which does not get better when turning the screen off
"KeepScreen" might help...

Wifi always requires manual connect???

Hey guys I tried searching but came up empty handed here.
Whenever I put my nook in standby (push power button or it automatically does it with inactivity) the wifi connection turns off. I've got it set to do that in spare parts so that it only stays "awake" while charging and not while idle.
The problem is it doesn't do that. Regardless of if it's charging or not, whenever I wake it up, even though wifi is enabled in the settings, it doesn't search on connect to my network. I have to go into Setting -> Wireless and as soon as I go into that menu, it finally connects automatically. It won't do it unless I go to that menu.
I'm rooted with the 1.0.1 Autonoonter btw.
Mine was doing something similiar. For me, it kept hanging up on obtaining an IP. I used an app called Wifi Static (free in the market) to set up a static IP and haven't had any problems since. Wifi seems to shut itself off way less often and when it does, it only takes 1-2 seconds to auto reconnect. Don't know if it will help you or not, but it's worth a try.
Have you done any modification of the wifi settings at all? Like the ad-hoc supplicant mod?
Quilombo said:
Have you done any modification of the wifi settings at all? Like the ad-hoc supplicant mod?
Click to expand...
Click to collapse
I have not.
I have the problem but it only happens with certain routers others work just fine . . . weird!
I have exactly the same problem. It started with the upgrade to 1.1. Affects stock or adhoc supplicant.Very annoying. Yet to find a fix

Change WiFi scanning duration??

I saw a thread about change the duration for WiFi scanning when not connected to WiFi. I know it scans every 30 seconds to see what networks are available for use, i think this will have a huge impact on battery for user that want to keep WiFi enabled all day, which is what i would like to do if there is a fix rather then turning it on when i get home off when on the train and on again when at work and off on the train and on at home
I know draky ROM has this set to like 2 minutes, so is there a way we can change it on Doc 9.6.6 speedmod K13C??
EDIT:
just went in the WiFi setting even after connecting to my home network with full bars and everything works fast, it still seems to scan for networks every 5 seconds. Is there a way to disable the scans? It should only scan when not connected to a network and continue after a network is connected.
jebise101 said:
I saw a thread about change the duration for WiFi scanning when not connected to WiFi. I know it scans every 30 seconds to see what networks are available for use, i think this will have a huge impact on battery for user that want to keep WiFi enabled all day, which is what i would like to do if there is a fix rather then turning it on when i get home off when on the train and on again when at work and off on the train and on at home
I know draky ROM has this set to like 2 minutes, so is there a way we can change it on Doc 9.6.6 speedmod K13C??
EDIT:
just went in the WiFi setting even after connecting to my home network with full bars and everything works fast, it still seems to scan for networks every 5 seconds. Is there a way to disable the scans? It should only scan when not connected to a network and continue after a network is connected.
Click to expand...
Click to collapse
Not sure if its clear- Your phone will not scan for WIFI networks if its connected to a WIFI network already. It is not possible to scan while connected unless you explicitly go to WIFI settings and check there- then the phone will scan for you because you are asking it to scan.
On the other hand, you can modify the WIFI ON time using this thread http://forum.xda-developers.com/showthread.php?t=774507&highlight=wifi+timeout
Hope this helps.
No im in the wifi settings and am for sure connected to my home network and i can see the scanning and the circle come up every 5 seconds. So it is scanning every 5 seconds even after connecting, i think it maybe a bug coz your right there is no reason for scanning to occur when already connected.
I'm not talking about the wifi sleep policy. In darky's ROm he has scanning set to 2 minutes so it will scan for networks every 2 minutes when its not connected to a network, for me i would like to change that to 15 - 30 minutes. I don't need it to connect right away when i get home or at work and find it stupid that it scans every 5 seconds for a network. If i really want wifi that badly i will do a manual scan and connect.
it will always refresh more frequently in the settings to let you know what is available to connect to... as soon as you close settings it will refresh less often.
i highly recommend juice defender... it will automatically turn off your wifi when disconnected for a while and connect it again later on. im pritty sure it checks when u turn the screen on. there are other settings and widgets that come with to control your 3g when its not needed to save battery
Haviic said:
it will always refresh more frequently in the settings to let you know what is available to connect to... as soon as you close settings it will refresh less often.
i highly recommend juice defender... it will automatically turn off your wifi when disconnected for a while and connect it again later on. im pritty sure it checks when u turn the screen on. there are other settings and widgets that come with to control your 3g when its not needed to save battery
Click to expand...
Click to collapse
Pls help, my TF101 is one day old, it was connected to my work wifi network that my X10 is connected to.
I mistakenly pressed on "forget network" and now it just scans but cant find the network. pls help me
khakhi said:
Pls help, my TF101 is one day old, it was connected to my work wifi network that my X10 is connected to.
I mistakenly pressed on "forget network" and now it just scans but cant find the network. pls help me
Click to expand...
Click to collapse
Maybe your work network doesn't broadcast ssid? You have to configure the connection manually if that is the case.
Sent from my GT-I9000 using Tapatalk
Herman76 said:
Maybe your work network doesn't broadcast ssid? You have to configure the connection manually if that is the case.
Sent from my GT-I9000 using Tapatalk
Click to expand...
Click to collapse
I have tried but still nothing...

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!

Why tasker doesn't always work?

Hi
Often on my galaxy A5 2016 rooted I see that a task is active but it doesn't really active the function on my phone...
For example: I've a task to turn wifi on when I'm at home (based on location). Often the task is active (is green on tasker) but wifi isn't turned really on! Why this??
copeppe said:
Hi
Often on my galaxy A5 2016 rooted I see that a task is active but it doesn't really active the function on my phone...
For example: I've a task to turn wifi on when I'm at home (based on location). Often the task is active (is green on tasker) but wifi isn't turned really on! Why this??
Click to expand...
Click to collapse
On my s8 I've had to turn on reliable alarms for when screen is of as I noticed that some profiles like turning Bluetooth on weren't working when the screen was off. Maybe that could help turning this on in the settings?
Sent from my SM-G950F using Tapatalk
mgdorbit said:
On my s8 I've had to turn on reliable alarms for when screen is of as I noticed that some profiles like turning Bluetooth on weren't working when the screen was off. Maybe that could help turning this on in the settings?
Sent from my SM-G950F using Tapatalk
Click to expand...
Click to collapse
Maybe... but can you explain me better what alarms I must turn on?
copeppe said:
Maybe... but can you explain me better what alarms I must turn on?
Click to expand...
Click to collapse
Go to preferences > monitor > Use reliable alarms. I have mine set for screen off
Location is not a reliable trigger (never was for me).
Try using variables. These are better.
For example.
I'm using 2 variables to CONFIRM I'm at home and trigger my home profile.
First... I use Cell near to verify the proximity and enable my WiFi. So my variable is set to "1".
Then... After my phone connects to my network I set another variable to "1".
When both variables are equal to "1" my home profile kicks in.
This way I do not rely on Location (and my power consumption is lower).
Sent from my LG-D855 powered by Aosp Extended and Tapatalk.
So the way tasker works is when a profile activates, the entry task runs, then when the profile deactivates the exit task runs.
If something interferes with the entry task, or if you have profiles that overlap (changing the same settings for instance) the profile will be active, but the desired actions may not be able to run.
However, when it comes to wifi on/off actions, you have to do a few things to ensure the actions can run.
1. Make sure you give yourself enough time to enable wifi before continuing.
Eg: 1. Turn on wifi
2. If connected to my home ssid do the following
This will never work because tasker enables the wifi and immediately goes to the next action, but you need at least 5 seconds (really 15) to connect, so it will never be connected when if statement is checked
2. Or say you want to disable wifi every time The wifi is disconnected from any ssid and whenever you're in range of your homer ssid another profile turns on wifi.
The following WILL NEVER WORK but will take a long time to realize the simplicity of why if not careful
If wifi=on and wifi is not connected
Disable wifi and do these things
The reason is the home profile will always enable wifi and for 15 seconds the disable WiFi profile will trigger because the wifi is on but not connected...so it'll disable WiFi.. which will... you get the idea.
P.s. if the profile is active then reliable alarms has nothing to do with why the actions didn't run. Tasker correctly activated the profile... something interfered elsewhere

Categories

Resources