Hello,
been looking and can't find a way to detect if a device is locked or not. Trying to detect if screen is turned on and system locked.
From reading on the net the way to detect if a device is unlocked, sort of, is to detect if screen is turned on, and ACTION_USER_PRESENT is set (API documented in http://developer.android.com/reference/ ... ER_PRESENT).
Would it be possible to get status of the ACTION_USER_PRESENT in Automagic?
Optionally, combine it to get a locked/unlocked status?
Lock/unlock status
Moderator: Martin
Re: Lock/unlock status
I might be able to help if you specify for what purpose are you trying to archive that.
Re: Lock/unlock status
Ideally I would like to temporarily set clipboard with password if "enter password" screen is shown (I have a SGS4). That way I can quickly do a paste with password to unlock phone. Company enforces password protection with max 15 minutes timeout. Driving me crazy to have to enter password every time I have to use the phone, but that's the way it's implemented.
Instead of detecting password screen, I'll settle for detecting if screen is on and phone locked (i.e. user not present).
Right now I set the clipboard as soon as screen lights up, but I rather have it done just at login time.
Hope this clarifies.
Instead of detecting password screen, I'll settle for detecting if screen is on and phone locked (i.e. user not present).
Right now I set the clipboard as soon as screen lights up, but I rather have it done just at login time.
Hope this clarifies.
Re: Lock/unlock status
I have sgs+ myself, so I'm not exactly sure how the login screen behaves with automagic but have you tried the "user present" trigger? That detects when you have screen on AND phone unlocked, but as I said, I'm not sure how login screen works with that.
Alternately, you can create a flow, which copies the password to clipboard when you turn screen of so you can paste it straight when you unlock your phone.
Alternately, you can create a flow, which copies the password to clipboard when you turn screen of so you can paste it straight when you unlock your phone.
Re: Lock/unlock status
"User present" works well. It gets triggered when user successfully login. In fact, looking back on my original request I have found all the functions that I requested and that I need - the more I learn about automagic the more impressed I get!
What I did not state previously is that I used "widgetlocker" for lock screen (to get some info without having to unlock phone). It issues a broadcast when slide to open.
Using the above, this is what I ended up with:
- "Periodic timer" trigger, set to the timeout value in lock screen setting in my SGS4. Action: set a global "locked" variable to true. In disabled status when screen is on, enabled when screen is off.
- "Screen Off" trigger. Action: if "locked" is not true, enable "Periodic timer" flow
- "Screen On" trigger. Action: disable "Periodic timer" flow
- "General Broadcast" listening for when widgetlocker issues a unlock broadcast. Action: if "locked" is true, set clipboard to password, wait for 20 or 30 seconds (not important, but for safety), then restore clipboard.
- "User Present" trigger. Action: if "locked" is true, restore clipboard, and set "locked" to false.
A bit unwieldy but seems to do the trick.
Anyway, thanks for your support!
What I did not state previously is that I used "widgetlocker" for lock screen (to get some info without having to unlock phone). It issues a broadcast when slide to open.
Using the above, this is what I ended up with:
- "Periodic timer" trigger, set to the timeout value in lock screen setting in my SGS4. Action: set a global "locked" variable to true. In disabled status when screen is on, enabled when screen is off.
- "Screen Off" trigger. Action: if "locked" is not true, enable "Periodic timer" flow
- "Screen On" trigger. Action: disable "Periodic timer" flow
- "General Broadcast" listening for when widgetlocker issues a unlock broadcast. Action: if "locked" is true, set clipboard to password, wait for 20 or 30 seconds (not important, but for safety), then restore clipboard.
- "User Present" trigger. Action: if "locked" is true, restore clipboard, and set "locked" to false.
A bit unwieldy but seems to do the trick.
Anyway, thanks for your support!
Re: Lock/unlock status
Maybe someone could move this thread to "User help / Bug Reports"?