j4velin / Pedometer

Lightweight pedometer app for Android using the hardware step sensor
https://play.google.com/store/apps/details?id=de.j4velin.pedometer
Apache License 2.0
1.44k stars 672 forks source link

Android System thinks pedometer is running in the foreground #131

Closed lwmv closed 5 years ago

lwmv commented 5 years ago

I'm running LineageOS 15.1, Android 8.1. I updated Pedometer from v1.5.6 to v1.5.8 today. The change log of v1.5.8 reads "add settings shortcut to notification settings on Android 8+". Now in the settings of pedometer there is a "Notification settings" option, I click on this option and it will jump to the system notification settings of pedometer.

Now the problem is, if I turn off the notification of Pedometer, the Android System will show a notification saying that "Pedometer is using battery". And in the battery usage information of Pedometer, the "While in background" entry is 0 minute, the “While in active use" entry equals the time I unplug my phone after full charge. That is to say, though pedometer is actually running in the background, the Android System thinks Pedometer is running in the foreground (in active use) and pop up a notification notifying me of that.

I downgrade to v1.5.6 and the issue is gone. Now Pedometer is being deemed by the Android System as being running in the background again, and the "While in background" entry starts to grow normally. No notification of "Pedometer is using battery" any more. In the settings of v1.5.6, the "Show notification" is a check box, instead of an option that will direct me to the system notification settings of Android 8.1.

pedometer_v1 4 8

j4velin commented 5 years ago

With the target SDK now set to 8.0, the app needs to have a "foreground service" to be kept alive. And foreground service require a notification for some reason...

lwmv notifications@github.com schrieb am Do., 8. Nov. 2018 um 11:37 Uhr:

I'm running LineageOS 15.1, Android 8.1. I updated Pedometer from v1.5.6 to v1.5.8 today. The change log of v1.5.8 reads "add settings shortcut to notification settings on Android 8+". Now in the settings of pedometer there is a "Notification settings" option, I click on this option and it will jump to the system notification settings of pedometer.

Now the problem is, if I turn off the notification of Pedometer, the Android System will show a notification saying that "Pedometer is using battery". And in the battery usage information of Pedometer, the "While in background" entry is 0 minute, the “While in active use" entry equals the time I unplug my phone after full charge. That is to say, though pedometer is actually running in the background, the Android System thinks Pedometer is running in the foreground (in active use) and pop up a notification notifying me of that.

I downgrade to v1.5.6 and the issue is gone. Now Pedometer is being deemed by the Android System as being running in the background again, and the "While in background" entry starts to grow normally. In the settings of v1.5.6, the "Show notification" is a check box, instead of an option that will direct me to the system notification settings of Android 8.1.

[image: pedometer_v1 4 8_notification_off] https://user-images.githubusercontent.com/1805467/48193276-18bd1300-e385-11e8-9245-028b0f685191.jpg [image: pedometer_v1 4 8_pedometer_is_using_battery] https://user-images.githubusercontent.com/1805467/48193277-1955a980-e385-11e8-85ca-b562e8d14563.jpg [image: pedometer_v1 4 8_while_in_background_0minute] https://user-images.githubusercontent.com/1805467/48193278-1955a980-e385-11e8-8dd8-188b1c3cdeae.jpg

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/j4velin/Pedometer/issues/131, or mute the thread https://github.com/notifications/unsubscribe-auth/ADwmy14K_igrx6JRhG5C46nPHNGlN_ioks5utAlUgaJpZM4YUaSV .

lwmv commented 5 years ago

OK, I will just ignore the "Pedometer is using battery" notification.

artfulrobot commented 5 years ago

I realise it's not this app's fault, it's some hideous Android decision, but I down graded to an earlier version of this app to avoid the notification confusion and top bar clutter that the latest version brings.