proximity sensor + inactivity timer -> pocket locker?

1,209 views
Skip to first unread message

wiiareonfire

unread,
Mar 5, 2012, 10:37:36 PM3/5/12
to tas...@googlegroups.com
Does anybody know of a way to get the screen to lock if the proximity sensor triggers, and there's been x seconds inactivity?

Of course, with this comes with inactivity, assuming anybody has found a way to do that yet. You'd also be able to have wifi/data turn off after a while, to save battery, if your ROM doesn't support such things.

Axel

unread,
Mar 6, 2012, 2:46:38 PM3/6/12
to Tasker
I actually just did this last week and so far it's worked great (huge
disclaimer: There might be a better way to accomplish this but I know
that this will work).

The idea is that tasker would notice that proximity sensor is in use,
then wait a certain amount of time before it turned the screen off if
the proximity sensor was still engaged.

First I made a Profile where the State--> Proximity Sensor--> Variable
Set "%Proximity ~ On", then Variable Set "%Proximity ~ Off" as the
exit task. I made it a Global variable so I can use it in other
profiles...you might too.

Then I made 2 more Global Variable Profiles based on the phone State.
Phone Offhook -->Variable Set "%OnCall ~ 1"
Phone Idle --> Variable Set "%OnCall ~ 0"

Then I made another Proximity Sensor Profile called "Pocket Screen
Off", then made a task called "Screen Off" where:
1. Stop If %OnCall ~ 1
2. Wait 2 Seconds
3. If %Proximity ~ On
4. Wait 3 Seconds
5. System Lock if %Proximity ~ On

Lastly I added a NOT Application Context to the "Pocket Screen Off"
profile so that it would not engage during certain applications where
I put the phone to my ear (such as Voicemail)

As the disclaimer states, there is probably a cleaner method...

On Mar 5, 9:37 pm, wiiareonfire <wiiareonf...@gmail.com> wrote:
> Does anybody know of a way to get the screen to lock if the proximity
> sensor triggers, and there's been *x* *seconds *inactivity?

J.

unread,
Mar 7, 2012, 4:48:27 PM3/7/12
to tas...@googlegroups.com
Here's what I do for a pocket locker:

Profile: InPocket
Contexts:
Orientation - upside down
Proximity Sensor
Enter Tasks:
Silent Mode - Vibrate (if %SILENT ~ off)
WidgetLocker - Activate
Variable Set - %INPOCKET to 1
Exit Task:
Variable Set %INPOCKET to 0


Profile: InPocketSide
Contexts:
Variable Value %INPOCKET ~ 1
Orientation: Left Side
Task: Silent Mode - Vibrate (if %SILENT !~ Vibrate)

It works well for me!

Cheers
Reply all
Reply to author
Forward
0 new messages