Tasker to proximity screen off


If you are using proximity screen off pro or smart screen off, you may know how convenient it is to automate our lives via built-in proximity sensor.
Now I am going to show you how tasker done this job to replace proximity screen off pro.
Before all of it, just a reminder, you may go to tasker preference interface, and click on the tab of monitor, then pull down the screen, you will find the option for proximity sensor, “No” means proximity sensor will shut off when the screen turns off, back on when the screen turns on. I guess it might avoid any unnecessary loss for the sensor since you may prefer saving more battery.
Profile 1: (proximity screen off 1)
Context-state-sensor-proximity sensor
Action-variable-variable set-name %Proximity, to On
Exit action- variable-variable set-name %Proximity, to Off
Profile 2: (proximity screen off 2)
Context 1-state-sensor-proximity sensor
Context 2-state-display-display orientation, portrait # if you are playing some game which requires full screen in landscape, this profile would not interrupt.
Context 3-state-phone-call, type-any, invert # this action is to avoid the situation while incoming or outgoing call occurs.
Context 4-state-app-not camcorder, camera, flashlight # for some specific apps, you might not want to be interrupted as well. Eg. Like you are using flashlight.
Action 1-task-wait 5 seconds # give you 5 seconds to avoid some unexpected cases.
Action 2-display-system lock, if %Proximity~On # 5 seconds later if it is still being fired, then system lock the phone.

原文地址:https://www.cnblogs.com/shangdawei/p/4510972.html