mapbox / mapbox/mapbox-maps-android
PointAnnotations are not visible until the online mode is enabled on the map screen at least once
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Kotlin
- Sterne
- 578
- Forks
- 161
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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:
- 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)
- Before tapping on "VIEW MAP" button remember to turn on flight mode on your device.
- Tap on "VIEW MAP" button, verify if PointAnnotations and CircleAnnotation are visible. Focus map on the area where PointAnnotations should be present.
- 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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit app/src/main/java/com/mapbox/maps/testapp/examples/OfflineActivity.kt und reproduziere das Problem mithilfe seines Offline-Ablaufs, indem du neben der vorhandenen CircleAnnotation PointAnnotations hinzufügst. Vergleiche die Annotationen, bevor und nachdem du den Netzwerkzugriff kurz aktiviert hast, und verfolge anschließend die relevanten Android-Annotation- und Offline-Initialisierungspfade. Als abgeschlossen gilt die Aufgabe, wenn PointAnnotations beim Öffnen der Karte im Offline-Modus sichtbar sind und nach einem Neustart sichtbar bleiben, ohne zuvor in den Online-Modus zu wechseln.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- android, kotlin
- Bereich
- mobile
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100