0

How can make it so wi-fi gets disabled automatically when screen gets locked, if possible after 1 minute or so? Then enabled automatically when screen gets unlocked. My screen is set to lock after 30 seconds or so

also, is it possible to turn off wifi when there's no network in range? I think it takes a lot of battery searching for networks. Or maybe increase the search interval somehow

  • I'm sure your aware anyway but regarding your second request, if you turn off WiFi when no networks are in range it will not turn on again automatically (unless you have another profile to do that) – Jonny Wright May 26 '14 at 10:29
2

So I combined what you asked for into a single task. You'll first create a profile which triggers when a state changes. You'll select Display State and chose off. Tasker can't actually able to tell if your screen is locked, only on or off but we can get around that as long as we know the time it take for the screen to lock.The task is as follows:

  1. Wait Until
    Seconds: 60
    Until: %SCREEN Matches ON
  2. IF
    %SCREEN Matches ON

  3. Wifi
    Set: ON

  4. STOP
  5. END IF
  6. IF
    %SCREEN Matches OFF

  7. Wifi
    Set: OFF

  8. GOTO TYPE: ACTION NUMBER
    NUMBER: 1

  9. END IF

Explanation of Task: 1. This causes the task to wait before continuing unless the condition is met. The total wait time should be the screen time until lock plus the time you want to wait until the wifi turns off 2. If the screen Turns on goto 3 3. Turn on wifi 4. Stops task 5. Ends if Statement 6. If the screen is off on goto 7 7. Turn off wifi 8. Cause a loop to keep checking the screen status.


Note 1: This task assumes that wifi is already on to start with.

Note 2: As the task stands now it will check every minute. If after the first min you want to change the time it waits to reduce battery usage you'll add this take to beginning.

1.SET VARIABLE
    NAME:%DUR
    VALUE: 60
2.WAIT UNTIL  
    SECONDS: %DUR  
    Until: %SCREEN Matches ON

And add in between 7 & 8:

SET VARIABLE
    NAME:%DUR
    VALUE: WHATEVER TIME

LAST NOTE: If you don't want to wait seconds every time you can use a variable for mins or hours like with seconds. You'll set the variables for min or hour as zero at the beginning and then change them before you start the loop. To use variables instead of static numbers you touch the symbol of 2 arrows crossing opposite of Min/Hr/Sec.

If you have any question please feel free to ask. Also since I'm new please don't forget to mark mine as the answer if it solves your problem and to upvote the answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.