• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Tasker Help. PLEASE!

DonMiguel

Newbie
Ok I just got tasker and I have set up a few profiles (sound alert when plugged in, 3G on when certain apps are opened and no wifi) but the main main reason I got the app was so that I could have my wifi turn itself off when my phone is idle, say if the screen is turned off for 5 minutes and then come back on when I turn the screen back on. Also I would like it to automatically turn wifi on when I am home and then turn it off when I am not. This may seem like a lot to ask for but if you help me I would really appreciate it.
 
The Wifi stuff is relatively easy, but you need to decide how you want to determine if you're at home. In order of increasing power usage and accuracy of location, your choices are basically Cell Near, Location (net only), Wifi Near, and Location (GPS). I've used Cell Near and Location (net only) before and it doesn't really work for me, so what I'm doing now is "sort of" Wifi Near.

Anyway, here's what I would do in your case:

Profile: Wifi Scan
Context: Variable Value %SCREEN on
Context: Wifi Near [Toggle Wifi: Yes]
Enter Task:
Stop

Profile: Wifi Connected
Context: Wifi Connected
Enter Task:
Wifi On
Exit Task:
Wait 10 seconds
Wifi Off If %PACTIVE !~ *,wifi connected,*

Profile: Screen Off
Context: Variable Value %SCREEN off
Enter Task:
Wait 5 minutes
Wifi Off If %PACTIVE ~ *,screen off,*

Note: All tasks with a Wait action should have collision handling set to Abort Existing.


Profile "Wifi Scan" scans for Wifi networks at the configured intervals (default: every 2 minutes while the screen is on, every 10 minutes while the screen is off), but will only do so while the screen is on. The Enter Task doesn't do anything, it's just a placeholder, but it's required because you can't have a profile without a task. All the profile really does is force the Wifi Scan. But if there are any known networks nearby, Android will connect to one of them while Wifi is on for the scan (I once considered this side effect of scanning to be an annoyance, but now use it to my advantage). If Wifi connects during the scan, profile "Wifi Connected" is activated.

Profile "Wifi Connected" is activated by a Wifi connection (as indicated above). The Enter Task turns Wifi on. This is necessary because if you don't do this, Tasker will turn Wifi off at the completion of the Wifi scan - this tells Tasker to keep Wifi on. When Wifi is disconnected (i.e. you've gone out of range), the Exit Task waits 10 seconds, then turns Wifi off, but only if it's still disconnected (%PACTIVE !~ *,wifi connected,*).

The Wifi Sleep Policy should handle turning Wifi off when the screen is off (after a 15 minute timeout, I believe), but if you want more control over it, you can use the "Screen Off" profile.

Profile "Screen Off" waits 5 minutes after the screen turns off, and if it remains off for 5 minutes, Wifi is turned off.

I have several profiles that use a Wifi Near context, and I used to have "Toggle Wifi" enabled in all of them. But this made it far too cumbersome to manually control Wifi when I wanted to turn if off for some reason, as I would have to disable all of the profiles that used a Wifi Near context. Using the Wifi Scan profile allows me to disable Toggle Wifi in all other profiles, but I still get the benefit of having it enabled, and only have to disable a single profile if I want to manually control Wifi.

It should be noted that if you have known networks configured that require some sort of login and acceptance of terms (i.e. a Wifi hot spot), this set of profiles may leave you connected to a Wifi network that's blocking your traffic until you login or accept the terms - meaning you won't really have a working connection).
 
Back
Top Bottom