Search code examples
androidpermissionsandroid-permissionslocationmanagerandroid-12

Why won't Android 12 record travel?


My app collects locations with a foreground service, and it has been working well up through Android 11. With the Android 12 beta, with all permissions that work well for previous versions granted, I'm getting very few locations, well below my update interval settings, sometimes not for several minutes at a time.

Are there some Android 12 changes for running apps with a foreground service, with the LocationManager, or anything else that might affect this?

Edit: Tried mock locations; those come in fine. Also tried adding

 android:foregroundServiceType="location"

... which didn't help. I've thought about switching to the Fused Location Provider API, but I've read that doesn't help to get more locations, just the opposite.

My next step is to use the "gps" location provider with the LocationManager; my guess is that will get more locations, but my app has been handling the types of locations from the "fused" provider, so I'd really like a better option.


Solution

  • Using FusedLocationProviderClient instead of LocationManager for Android 12 worked; it looks like using the "fused" provider with LocationManger.requestLocationUpdates with Android 12 will no longer cause new locations to be collected.