FHellmann / Uniatron

This project is part of the course Mobile Application Development at the University of Augsburg
https://play.google.com/store/apps/details?id=com.edu.uni.augsburg.uniatron
Apache License 2.0
0 stars 3 forks source link

Services go to suspend overnight #35

Closed leonpoint closed 6 years ago

leonpoint commented 6 years ago

Services will not start itself after the phone has been idle for a long time. This might be caused by Samsung battery optimization, or Android Doze.

To Reproduce Steps to reproduce the behavior:

  1. Install a second Android Stepcounter app (e.g. https://play.google.com/store/apps/details?id=pedometer.steptracker.calorieburner.stepcounter&hl=de )

  2. In the morning, take some steps and watch and other app increase its steps

  3. After a while, open Uniatron and see the recorded steps are 0.

Expected behavior The app should countt steps no matter the state or time

Suggestions:

  1. register to PowerManager and detect the end of a doze state. See: https://developer.android.com/reference/android/os/PowerManager#ACTION_POWER_SAVE_MODE_CHANGED
  2. Create a persistent notification
  3. After installation, prompt user to add app to battery optimization whitelist (the Pedometer app does this in a good way) #20

Samsung Galaxy S8, Android 8.0.0

leonpoint commented 6 years ago

see https://stackoverflow.com/a/29608040 for notification

leonpoint commented 6 years ago

https://pacerhealth.zendesk.com/hc/en-us/articles/218492567-My-Android-phone-stops-counting-steps-What-should-I-do-

leonpoint commented 6 years ago

Fixing delayed until confirmation from rest of the team. Do the services work on all other devices?

leonpoint commented 6 years ago

https://github.com/bagilevi/android-pedometer/blob/master/src/name/bagi/levente/pedometer/StepService.java