https://developer.android.com/about/versions/oreo/background-location-limits
In an effort to reduce power consumption, Android 8.0 (API level 26) limits how frequently background apps can retrieve the user's current location. Apps can receive location updates only a few times each hour.
The documentation does not give any specifics about the limits on the frequency of background location retrieval.
Assuming my app running on an Android O device does not come into the foreground and does not receive any passive location updates, how many times can I reliably expect it to receive location updates?
How many times is "only a few times" exactly?
Quite an old question now but I've spent alot of time recently trying to get an app like this to work. I had a perfect app in older Android versions but it now seems impossible.
The answer will probably vary depending on devices but with my Galaxy S7 units (Oreo) I can set the location going as often as I want to, even every 5 seconds. But afer 45-60 minutes of idle, the service will just slow down, until the app is brought into the forground manually again.
I have tried Job Scheduler, Worker, AlarmManager, AlarmManager with Wake Lock and with 'setAndAllowWhileIdle()', and they all give the same results: fully active location changes for 45 minutes or so, than only once every 15 minutes or so (if you're lucky: it can be more than an hour and seems unpredictable)
[edit, a year later] I have managed to improve this now, by restarting the (background) location service every hour (using an alarm), updates continue every 2 minutes as requested (for over a week now...) - but only if the device is either powered up or moving. If on battery, and the location isn't changing, updates revert to every hour or so. Same on android 11. See my new question here
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