2

In my code sample, location updates are not sent on an Android O device when it goes into idle (doze) mode. Has anyone gotten this to work? There are no issues on any devices prior to Android O (before API 26 added the location update throttling)

The code in question is here: https://github.com/jcraw/api_26_location_updates_idle

The MainActivity binds to a foreground service which puts the location updates into logcat.

The code was tested as follows:

  1. Create virtual device (Pixel API 26)
  2. In the 'extended controls' for the virtual device, load and then start a GPX file
  3. Use power button on virtual device to disable screen
  4. adb shell dumpsys battery unplug
  5. adb shell dumpsys deviceidle step
  6. repeat step 5 until device is in IDLE state
JCraw
  • 404
  • 2
  • 12
  • You could try using the new Context.startForegroundService() to start the service instead of binding to the service. Maybe there are some clues here too: https://developer.android.com/preview/features/background-location-limits.html – M66B Jul 01 '17 at 12:14
  • @M66B I had no luck with that either – JCraw Jul 07 '17 at 15:48
  • There is a similar question with other suggestions here: https://stackoverflow.com/questions/44811812/foreground-service-not-receiving-location-updates-in-doze-mode-in-android-o – M66B Jul 09 '17 at 14:53

0 Answers0