I have developed an app which runs a background service that gets a GPS fix (using Google Play Services GPS capability) every 30 seconds. If the GPS location matches a location on a list that the service reads in from a file, then it sends a broadcast that triggers a foreground activity to pop up with some information.
Most of the time, the user is unaware of the app and can do other stuff. The foreground UI will probably not be triggered more often then every 2 minutes, and it could be as long as 20 minutes or more. The rest of the time, it is important that the app can continue to get GPS locations without interrupting whatever else the user is doing.
From reading the latest docs, it looks to me as if the DOZE feature in Android 8 means that this will no longer work, and the background service will not get its updates (or will only get a few every hour, which is useless). They appear to say that I should use a foreground service, but elsewhere they say that foreground services should only be used where some user interaction is needed.
Catch 22!! Can anyone suggest a way around this, or explain what I am missing (I am no expert, so I may well have missed something!)
Most of the time, the user is unaware of the app and can do other stuff. The foreground UI will probably not be triggered more often then every 2 minutes, and it could be as long as 20 minutes or more. The rest of the time, it is important that the app can continue to get GPS locations without interrupting whatever else the user is doing.
From reading the latest docs, it looks to me as if the DOZE feature in Android 8 means that this will no longer work, and the background service will not get its updates (or will only get a few every hour, which is useless). They appear to say that I should use a foreground service, but elsewhere they say that foreground services should only be used where some user interaction is needed.
Catch 22!! Can anyone suggest a way around this, or explain what I am missing (I am no expert, so I may well have missed something!)