Page 1 of 2
screen condition
Posted: 10 Mar 2014 16:19
by Ankit
Hi
Is it possible to determine in condition wheather the screen is locked or unlocked.
I dont mean display on or off.....
Re: screen condition
Posted: 10 Mar 2014 16:53
by Martin
Hi,
Not yet. Coincidentally I have just added a new condition for this that should become available in the next EAP version (Android 4.1+ only).
In the meantime you could try to store the state with a trigger Display State: Off and trigger User Present which should be executed when the device is unlocked on most phones:
Flow1
-trigger Display State: Off
-action Script: global_locked = true;
Flow2
-trigger User Present
-action Script: global_locked = false;
This procedure will only work when no lock timeout is used and the device immediately locks when the screen turns off.
Regards,
Martin
Re: screen condition
Posted: 11 Mar 2014 02:26
by Ankit
Hi martin,
Thanx for your reply but i have one more doubt.
I have created one overlay widget and i want that it should only be visible on lock screen and not on unlocked screen........
Please help!!
Thanx in advance!!
Re: screen condition
Posted: 11 Mar 2014 11:20
by MURTUMA
I haven't tried overlay widgets, so I'm not sure if they work on lockscreen. I'm going to assume they work and base in tips to that assumption.
You need two flows.
Flow1: trigger, screen on.
This handles showing the widget when you turn your screen on.
Flow2: trigger, user present.
This flow hides the widget, after you unlock your phone.
If you use timeout to keep the phone unlocked after screen turns off, the widget will show itself so you might want to add some timer to hide that for a dirty fix.
When Martin implements that new condition, you can add that to the flow1 so you won't need any dirty fixes for that. On the other hand, it you don't use the locking timeout, this should work perfectly without any "fixes".
Re: screen condition
Posted: 12 Mar 2014 06:37
by Ankit
Hi
Thanx martin
Thanx murtuma
It is working perfectly!!
Overlay widget action is amazing!!
Re: screen condition
Posted: 12 Mar 2014 14:01
by Ankit
But how to unlock a locked screen using automagic??
I am not using any pin or pattern.
I am only using swipe screen lock......
Re: screen condition
Posted: 12 Mar 2014 16:44
by Martin
You can use action Set Keyguard State: Off to disable the keyguard. Unfortunately this action is known to not work well (or at all) on some devices.
On some devices you can use Execute Root Command: input keyevent 82 to dismiss the slide-to-unlock lockscreen (does not work on all devices).
Re: screen condition
Posted: 12 Mar 2014 17:07
by Ankit
In my device input keyevent 82 is menu....
How will menu open the lock??
Re: screen condition
Posted: 12 Mar 2014 17:14
by Martin
Some ROMs support to unlock the screen with the menu key when the slide-lock is used. This seems to work on a Nexus 5 with 4.4 but also worked on some other devices when I recall correctly.
Re: screen condition
Posted: 12 Mar 2014 17:20
by Ankit
No martin
Its not working..
Keyguard state unlocks the screen but it permanently disables the screen lock..