I have app for android that needs to send on regular intervals (let's say every 10 s) an location update to the server. So far nothing special. However this is done completely in the background as an service. This app uses LocationManager to regulary receiving the current GPS location and send this to the server. This this of course the simplified story of the app, just focussing on the issue
The complete app is working ok until android 6. In android 6 the app stops sending updates when the sreens is off after a while, but comes alive again after movement, screen on or charging. This caused by the Doze function, this is oke. As long the the app sends location updates after movement.However on Android 7 the location updates are only received on the server when the screen is on or charging. Movement (like walking) does not trigger to turn of Doze (at least no location updates are received on the server). The app is alos whitelisted for battery optimization, but that doesn't help. Probably by the the GPS/network is turn off.
Reading the Android documention, I don't see a sollution for receiving and sending the current GPS locations at interval controlled by the app in the background when the device is Doze.
Is there a sollution or can give somebody a direction to solve this GPS problem I have for android 7?
Thanks.
Found the solution for this. Make sure that it is a foreground service instead of backgorund. A good article can be found in https://developer.android.com/preview/features/background-location-limits.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With