mapbox / mapbox/mapbox-maps-android

Entering the tunnel and then exiting, unable to obtain the latest positioning information, the current location icon on the map will no longer update its position

Open
#2,692 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :beetle:
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Android OS version:Android 14
- Devices affected:Most mobile phones
- Maps SDK Version: com.mapbox.maps:android-ndk27:11.16.6,com.mapbox.navigationcore:android-ndk27:3.17.0-rc.3

## Observed behavior and steps to reproduce
1、Use the demo to obtain the current user location data. The app is always in the foreground. After entering the tunnel for more than ten minutes, the latitude and longitude returned by the "onNewPositionMatcherResult" method are always the latitude and longitude before entering the tunnel. The killing process will not update the latitude and longitude again

2、Our self-developed app uses mapboxNavigation. startTripSession() to start positioning, obtain the current location, exit to the background, enter the tunnel for more than ten minutes, and exit the tunnel. The "onNewPositionMatcherResult" method always returns the latitude and longitude before entering the tunnel, and the puck stops at the position when exiting to the background, not the current position. Killing the process will not update latitude and longitude again

![Image](https://github.com/user-attachments/assets/2572507a-4adf-4dda-86d5-a2983dafc592)

## Expected behavior

1、Start positioning through "mapboxNavigation. startTripSession()" and return latitude and longitude through "onNewLayoutMatcherResult" in "PositionObserver"
2、Configuration:MapboxNavigationApp.setup(
NavigationOptions.Builder(context).locationOptions(
LocationOptions.Builder().request(
LocationProviderRequest.Builder().interval(
IntervalSettings.Builder().interval(3000L).minimumInterval(3000L).maximumInterval(3000L).build()
).accuracy(AccuracyLevel.HIGHEST).displacement(10F).build()
).build()
).build()
)

## Notes / preliminary analysis

1. The accumulation of internal cache in SDK leads to continuous return of historical latitude and longitude
2. SDK does not automatically switch location providers internally
3. Kill process re-entry, SDK failed to request new latitude and longitude again

## Additional links and references

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PositionObserver callbacks, especially onNewPositionMatcherResult and the expected onNewLayoutMatcherResult, then trace the startTripSession flow configured through MapboxNavigationApp.setup and LocationOptions. Reproduce the tunnel and background scenarios described in the issue; done means callbacks and the map puck resume reporting the current location after exiting the tunnel.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.