markusfisch / ScreenTime

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

Screen time since last full charge #8

Open ghost opened 2 years ago

ghost commented 2 years ago

It would be nice to have an option to show the screen time since last full charge because the feature in Android usually resets after a few days. Hopefully this could work more reliably in this app than it does in Android.

markusfisch commented 2 years ago

Well, this would require the app to constantly monitor the battery status, which is not a good idea as it itself affects battery consumption. See: https://developer.android.com/training/monitoring-device-state/battery-monitoring#MonitorLevel

There are just two system broadcasts we could listen to (without consuming more energy than we should): ACTION_BATTERY_LOW and ACTION_BATTERY_OKAY. So there's no good way to know (exactly) when a full charge is reached, unfortunately.

But the app could listen to ACTION_POWER_DISCONNECTED. Would that make sense to you? To see the screen time since the last connection with the power cable? 🤔

ghost commented 2 years ago

But the app could listen to ACTION_POWER_DISCONNECTED. Would that make sense to you? To see the screen time since the last connection with the power cable? 🤔

I think this would be good enough.