Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Location tracking issues Android 12 #730

Open
felixkrautschuk opened this issue Apr 5, 2022 · 1 comment
Open

Location tracking issues Android 12 #730

felixkrautschuk opened this issue Apr 5, 2022 · 1 comment

Comments

@felixkrautschuk
Copy link

In our Android app, the location tracking is not working as expected and it seems that only Android 12 devices are affected.
We are using Mapbox Android SDK 9.7.2 in our production app and we followed this guide to retrieve location updates and to update the location marker position: https://docs.mapbox.com/android/core/guides/#requesting-location-updates

This is our experience:

  • when starting the location tracking, the location puck is shown at a different position (about 300m away, off a pedestrian path or road, ...)
  • the location puck has gray color right after the tracking has started, which indicates that the app did not receive any location updates
  • while moving outside, the the LocationEngineCallback always returns the same location (sometime it never changes, sometimes it changes suddenly after 3 minutes while walking outside) -> so the location marker does not change its position on the map
  • I do not see any warnings or exceptions in Logcat
  • when running Google Maps on the same device (it is a Google Pixel 3a) and track the location, everything works as expected so it is not a connectivity issue
  • when the same device was running Android 11 some months ago, those problems did not occur

We do not have multiple devices with Android 12 for testing, only the Google Pixel 3a. But we have a second device with Android 11 and those problems do not occur there, so this device acts the same way as the Pixel 3a did when there was Android 11 running.

I tried running the latest Sample App using the Mapbox v9 sdk from https://github.com/mapbox/mapbox-gl-native-android/tree/main/MapboxGLAndroidSDKTestApp and the location is also not correctly updated there.

Screenshot_20220405-092119

One difference to our production app: the location puck is blue, indicating that the location updates are correctly received, but the puck still does not move and the Toast shows the exact same coordinates all the time while walking, going by car or tram.

Is there anything that I am missing? Is it a bug in the v9 sdk? I am thankful for ANY advice.

I know there is already v10 outside, but we have no time at the moment to migrate and according to the Readme of this repo, v9 should be still supported so I hope that I can get some help here.

@felixkrautschuk
Copy link
Author

felixkrautschuk commented Apr 7, 2022

I just realized that the location gets updated correcly for one time, after switching to the Google Maps app, show the user location there and then switching back to our app. The puck is moving to the latest location then, but it is again not getting any further updates (until switching to Google Maps app again).

When adding the play-services-location library to build.gradle, the location tracking is working as expected on our Android 12 device.

implementation("com.google.android.gms:play-services-location:19.0.1")

The docs at https://docs.mapbox.com/android/maps/guides/user-location/#location-provider mention that, but to me it sounded optional.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant