screen condition

Post your questions and help other users.

Moderator: Martin

Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

screen condition

Post by Ankit » 10 Mar 2014 16:19

Hi
Is it possible to determine in condition wheather the screen is locked or unlocked.
I dont mean display on or off.....

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: screen condition

Post by Martin » 10 Mar 2014 16:53

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

Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Re: screen condition

Post by Ankit » 11 Mar 2014 02:26

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!!

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: screen condition

Post by MURTUMA » 11 Mar 2014 11:20

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".

Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Re: screen condition

Post by Ankit » 12 Mar 2014 06:37

Hi
Thanx martin
Thanx murtuma

It is working perfectly!!

Overlay widget action is amazing!!

Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Re: screen condition

Post by Ankit » 12 Mar 2014 14:01

But how to unlock a locked screen using automagic??

I am not using any pin or pattern.
I am only using swipe screen lock......

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: screen condition

Post by Martin » 12 Mar 2014 16:44

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).

Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Re: screen condition

Post by Ankit » 12 Mar 2014 17:07

In my device input keyevent 82 is menu....
How will menu open the lock??

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: screen condition

Post by Martin » 12 Mar 2014 17:14

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.

Ankit
Posts: 143
Joined: 11 Nov 2013 17:27

Re: screen condition

Post by Ankit » 12 Mar 2014 17:20

No martin
Its not working..
Keyguard state unlocks the screen but it permanently disables the screen lock..

Post Reply