mapbox / mapbox/mapbox-maps-android
PointAnnotations are not visible until the online mode is enabled on the map screen at least once
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 578
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
## Environment
- Android OS version: 13
- Devices affected: OnePlus 8
- Maps SDK Version: 11.4
## Observed behavior and steps to reproduce
PointAnnotations are not visible in offline mode until the online mode is enabled on the map screen at least once. CircleAnnotations at the same time show just fine.
It happens when you open maps in offline mode. It is enough to turn the network on for a short period of time on the screen with MapViews to make it work fine and keep working even if you restart the app or reboot the device.
The easiest way to reproduce is to take OfflineActivity from example application from Mapbox Android SDK (see links at the bottom) and modify it to add some PointAnnotations together with CircleAnnotation it is already adding. After tapping on "VIEW MAP" button CircleAnnotation shows but PointAnnotations don't.
## Expected behavior
Point annotations should be visible anytime.
## Notes / preliminary analysis
I have used slightly modified OfflineActivity from MapBox Android SDK example application. Modifications introduce adding several Points (or single one) as PointAnnotation. When you press "VIEW MAP" button, map shows with red CircleAnnotation in Tokyo area showing but none of PointAnnotations is visible.
Additional modification allows to verify that after entering online mode PointAnnotations immediately appear on the screen. You just need to:
1. Remove "OfflineSwitch.getInstance().isMapboxStackConnected = false" line (https://github.com/mapbox/mapbox-maps-android/blob/main/app/src/main/java/com/mapbox/maps/testapp/examples/OfflineActivity.kt#L85)
2. Before tapping on "VIEW MAP" button remember to turn on flight mode on your device.
3. Tap on "VIEW MAP" button, verify if PointAnnotations and CircleAnnotation are visible. Focus map on the area where PointAnnotations should be present.
4. Turn off flight mode. PointAnnotations should pop up immediately after network is connected.
Remark: Image for PointAnnotation iconImage is loaded from app's resources as Bitmap.
## Additional links and references
File which I have used for testing the feature:
https://github.com/mapbox/mapbox-maps-android/blob/main/app/src/main/java/com/mapbox/maps/testapp/examples/OfflineActivity.kt
Place where you should add your PointAnnotations (e.g. after creation of CircleAnnotation):
https://github.com/mapbox/mapbox-maps-android/blob/main/app/src/main/java/com/mapbox/maps/testapp/examples/OfflineActivity.kt#L101
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with app/src/main/java/com/mapbox/maps/testapp/examples/OfflineActivity.kt and reproduce the issue using its offline flow, adding PointAnnotations beside the existing CircleAnnotation. Compare the annotations before and after briefly enabling network access, then trace the relevant Android annotation and offline initialization paths. Done means PointAnnotations are visible when the map opens offline and remain visible after restart without first entering online mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100