Keyguard Toggle Widget

This guide will show you how to make a simple widget that toggles the keyguard on and off. This is useful because if you are at home, you don't want to have to manually unlock your phone every time you turn on the display. Conversely, if you are heading out, you want to secure your phone with the keyguard.

1. Long press on empty space on the desired Android home screen and select Widget.
2. Select Task.
3. Title the task Keyguard. Don't worry about the icon; we'll change it later.
4. Create these actions:

Action 1
Display > Keyguard
Set toggle

Action 2
Alert > Notify
Title: Keyguard enabled
Icon: Green check mark
Number: 0
Permanent: Unchecked
If: %KEYG matches on

Action 3
Alert > Notify
Title: Keyguard disabled
Icon: Red X
Number: 0
Permanent: Unchecked
If: %KEYG matches off

Action 4
Task > Wait
Seconds: 1

Action 5
Alert > Notify Cancel
Title: Keyguard enabled
If: %KEYG matches on

Action 6
Alert > Notify Cancel
Title: Keyguard disabled
If: %KEYG matches off

5. Once you have created these tasks, hit done and go back to your home screen.
6. Verify that the widget has been created. Don't worry about the icon, we'll take care of that shortly.
7. Go back into Tasker and hit Tasks.
8. Find the task for the widget you just created.
9. Create two new actions in between Keyguard Toggle(the first action you made) and Notify: Keyguard on(the second action you made):

Action 2
Tasker > Set Widget Icon
Name: Keyguard
Icon: Green check mark
If: %KEYG matches on

Action 3
Tasker > Set Widget Icon
Name: Keyguard
Icon: Red X
If: %KEYG matches off

10. Verify that you now have 8 total actions in the task, and that the two you just created are in positions 2 and 3.
11. Enjoy your keyguard toggle widget!

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License