3

I have the app Tasker, I want to know if there is a way I can create a task that changes the state of the lock screen setting "lock screen when power button pressed" from on to off and vice versa?

4
  • Would it be enough to turn screen locking on/off altogether? In that case, you could toggle keyguard. For finetuning, also take a look at the Secure Settings plugin. Always good ressources: Tasker UserGuide and my Tasker ressource collection :)
    – Izzy
    May 28, 2013 at 6:49
  • I wanted it to lock on power button when im not connected to wifi but just stay on a timer when im connected. Ive tried enabling keyguard on display off but it doesnt seem to do anything, when I push the power button again it just goes back to the unlocked state
    – Edd
    May 28, 2013 at 16:31
  • That should be the normal behaviour with keyguard off. As for your "timed keyguard", AFAIK that's made easier with the Secure Settings plugin. But OK, you gave some background -- let me try to put together something matching with Tasker. As I didn't yet work with Secure Settings, I can only include hints to that.
    – Izzy
    May 28, 2013 at 17:56
  • Here you go! Sorry that it took a little longer -- I was interrupted by a longer phone call...
    – Izzy
    May 28, 2013 at 20:32

1 Answer 1

3

I'm not sure if the following will be a perfect match for you, but you always can adjust it once you've got the idea. In my example, I will refer to Tasker only: not having worked with the Secure Settings myself, I can only tell things about it from the hear-say and what I've read.

Basic Tasker knowledge assumed:

  • Conditions:
    • StateWifi Connected, parameter: SSID set to your WiFi's SSID
    • StateDisplay is off
  • Task:
    • DisplayKeyguard off1

This is with plain Tasker, and should solve half of your problem: When connected to the specified WiFi, and the Display is turned off, turn off Keyguard. As soon as you turn on the display, the condition is no longer met -- and Keyguard would automatically be activated again. Problem will be: if you do not take any immediate action, that probably locks your screen again (first action of keyguard). To prevent this, you could try adding an exit task:

  • Exit Task:
    • TaskerWait, parameter is the time interval (start with e.g. 10s)
    • DisplayKeyguard on1

This would cause the Keyguard re-activation to be delayed by the given time interval. I did not try this -- it might very well be that keyguard still would lock the device, even though you already might do something in another app. But you have already noted the "footnote sign", so let's go for that:

1 Instead of handling Keyguard directly, let Secure Settings do that. I know it has the ability to e.g. have Keyguard only come up once (initially) when a condition is met. This would simplify things greatly: the Task then would be PluginSecure Settings, and the Secure Settings parameter should be to set Keyguard as described: "only needed once initially, then no more until the condition is no longer met". Also drop the "Display off" condition: when the display is off, you cannot unlock it either (you see where your problem most likely was). So it should work as you have intended -- after the first unlock.

Not exactly what you wanted (one-time unlock is still needed), but almost. The Exit Task would not be required in this case, as Tasker automatically reverts back once the condition is no longer met. Play a little with this, maybe Secure Setting even allows for something better.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .