-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Screen Unlock watcher #35
Comments
Newer android versions with "Digital Wellbeing" has this feature and likely has some API for this. Whether it's an open API or not though I don't know, I was not able to find anything after som googling. |
Looks like the code for google's Digital Wellbeing unlock counter live wallpaper is public, not sure if that would be helpful |
Ran across another open source app that does something similar, Look Counter. Looks like that app shows how many times you have unlocked your phone as well as how many times you just turned on the screen to check notifications. Kind of interesting Receiver which listens to SCREEN_ON, SCREEN_OFF, and USER_PRESENT events |
Turns out this might be a lot easier to implement than previously thought. The reason why these Apps listen to AW doesn't have the same requirements. Instead it can use UsageStatsManager, as it does currently to look into the history of device events, which include KEYGUARD_HIDDEN event types:
Note: I'm not sure why the documentation says "typically". As a test, I queried ActionDash has a backup feature which backs up the internal state as a sqlite database, and that's all you need to restore the App. Each row in the database contains following columns: id, applicationID,type,timestamp,className. These are the only event types it stores: CHOOSER_ACTION Since it doesn't contain anything else to reconstruct the 'unlocks' it's reasonable to expect the unlocks are based entirely on I think given the documentation for I think this could be implemented directly in |
@johan-bjareholt what are your thoughts on this approach? I can send a PR for it if you think this is the way to go |
@nicolae-stroncea Sounds really good, we could create a new bucket for that type of events and making a query that simply sums the amount of events and displays it in the web-ui should be trivial. |
As I mentioned in #30 at this comment it would be very interesting to have a watcher that can track how many times the phone is unlocked and/or how many times the screen is turned on (ie to check if you have any notifications). It's a great metric to identify just how often you are checking your phone.
I'm no android developer but a quick look through the intents found several which could be useful
ACTION_SCREEN_ON
ACTION_USER_PRESENT
ACTION_USER_UNLOCKED
The text was updated successfully, but these errors were encountered: