1

I've been running into this problem for a couple months now. My android app uses a foreground service (modeled on this to track the location of for brief periods. This was working well through Android P, but with the release of Android 10/Q, the foreground service stops sending updates for a period of ten minutes before beginning to again update like it should. These circumstances are:

Upon being backgrounded, the location updates will stop for a period of up to ten minutes before restarting and sending batched location updates appropriately. During this period the required foreground notification is still showing, and the service is running according to Android's OS. The only other odd behavior is that sometimes it will invoke the OnLocationAvailability callback of the LocationCallback, but it does this whether it's in the foreground or background.

Things I've done:

  • Disabling batched location updates: This works to get consistent updates, but breaks another super cool part of my app. I'd prefer to get the OS working properly, instead.
  • Adding both new Android Q manifest changes (ACCESS_BACKGROUND_PERMISSION and foregroundServiceType="location"). I did this as part of the Android Q update.
  • Expanded my logging in the foreground service, which has been useless since it just waits for the FusedLocationProviderClient

How should I progress in debugging this? It's been hard to gain more visibility into the foreground service and the fusedLocationProviderClient. Alternatively, if anyone has run into this issue, I'd also appreciate your feedback.

0014
  • 893
  • 4
  • 13
  • 40
JTZH
  • 11
  • 1
  • In Q the user can decide not to allow the OS to send location data to non-foreground apps. A foreground service would not count. This is intentional for privacy. – Gabe Sechan Jan 31 '20 at 21:14
  • This happens on a test device with all the location permissions granted, so that's not it, unfortunately. – JTZH Feb 01 '20 at 00:23
  • I have the same problem. – Brian Feb 23 '20 at 15:02
  • This is still aggravating me. I'm moving forward with batched updates being disabled, but it's definitely not my first choice. – JTZH Mar 27 '20 at 05:50

0 Answers0