markusfisch / ScreenTime

Displays your screen time in a permanent notification.
The Unlicense
114 stars 10 forks source link

screentime when shutdown #1

Closed marceltransier closed 2 years ago

marceltransier commented 2 years ago

The app appears to have counted shut down time as screen time. Maybe when the phone shuts down the screen is on and then the apps are being killed without sending the standby signal to the app. Maybe there is also a way to listen for shutdown events? (https://developer.android.com/reference/android/content/Intent#ACTION_SHUTDOWN)

markusfisch commented 2 years ago

Good catch! Thanks for making me aware of this! 👍 Will investigate…

markusfisch commented 2 years ago

Version 1.0.7 listens for ACTION_SHUTDOWN now (see https://github.com/markusfisch/ScreenTime/commit/3e2934a5f0fdb204ad0c6cf93d844746eda304dd).

Unfortunately, not all of my devices send ACTION_SHUTDOWN when shutting down (or rebooting) so the bug is not fixed for everyone 😬 But I'm still on it and I think I can find a solution. This is just a first step.

markusfisch commented 2 years ago

Version 1.0.8 doesn't depend on a closing event anymore. Now, the current session is updated with the ongoing notification and, finally but not necessarily, when there's a ACTION_SCREEN_OFF event.

So even a power loss wouldn't result in an open record anymore.