⚡️ How to lock an Android phone when pocketed: a Tasker recipe
During the last few months I have noticed that I've sent a number of messages and also changed some system settings unintentionally, all while trying to pocket my phone unlocked. Not something pleasant. And, to my surprise, there was no built-in setting for detecting owner's pocket. Thanks to Android's flexibility, we can develop our own.
Below you may find a working recipe for Tasker. Please be aware of the following caveats:
- Tasker cannot lock the screen itself while leaving the fingerprint scanner functioning. You'll need another application for that
- You might want to isolate a few applications from this recipe in order to prevent unexpected behaviour.
Step 1: isolate Google Phone (or any other dialer app) and maybe some of your fav games
In order to prevent unexpected hanging up, or locking the screen when gaming, isolate selected apps with a special profile:
- Create a task that sets any variable of your choice to
true
. Let's say we use%donotlock
variable - Create another task that unsets this variable
- Create a profile with Applications conditional
- Pick applications that you would like to isolate
- Select a task that sets the
%donotlock
variable totrue
- Long tap on tasks assigned to you new profile to add an exit task that unsets the variable
See pictures for more details
Step 1.1
Step 1.2
Step 1.4
Steps 1.5 and 1.6
Step 2: Install Pineapple Lock Screen
- Get the app from f-droid
- Launch the app
- Grant all required permissions (Accessibility)
- Test the screen lock functionality
See pictures for more details
The lock screen app
Required permissions
Step 3: Create a Tasker task that triggers Pineapple Lock Screen
- Create a new task
- Add a "Wait" step for convenience, I usually pick one second delay
- Add an Application step, long tap on "Pineapple Lock Screen", select the Lock Screen shortcut of the app
- Add a conditional that prevents this step from executing when
%donotlock
variable is set
- Add a conditional that prevents this step from executing when
See pictures for more details
Steps 3.1 and 3.2
Steps 3.3 and 3.3.1
Step 4: Assign a profile to your newly created task
- Create a new profile
- Select
State -> Sensor -> Proximity Sensor
- Assign your newly created task from step 3
- You're ready to go!
See pictures for more details
The end result
With this relatively small recipe I've gained confidence in me not making any accidental butt calls when tucking away my phone in haste while checking out at supermarket. Hope it helps you too!
Wed, 12 Jul 2023 12:36:38 +0200
RSS // Telegram // Статистика