I need to collect GPS data, save it to database and then send it to backend every minute. And I just want to make sure that Doze mode will not screw things up.
Let's assume that I launch my foreground service and implement
onLocationChanged
callback there.Do I have to do all that (collecting/storing/sending) in a foreground service just to be sure that Doze will allow to use GPS / internet?
If I want to store/send data somewhere else, e.g. in a
BroadcastReceiver
, how can I be sure that myBroadcastReceiver
is ready to handle data and is not asleep?There's a bug in Android M, which makes foreground services affected by Doze mode: https://stackoverflow.com/a/37869501/3210556
A possible woakaround is to launch foreground service in a separate process.
Assuming there's a foreground service in the app, what exactly is unaffected by doze?
- The foreground service itself?
- The process associated with the foreground service?
- The whole app?
Thank you.