mapbox / mapbox/mapbox-maps-android

CameraDebugView is not updating on app start

Open
#2,539 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Environment

  • Android OS version: 13
  • Devices affected: Google Pixel 4a
  • Maps SDK Version: 11.6.0, 11.8.1

Observed behavior and steps to reproduce

Compose app with MapView and MapViewDebugOptions.CAMERA enabled. For example - https://github.com/mapbox/mapbox-maps-android/blob/main/compose-app/src/main/java/com/mapbox/maps/compose/testapp/examples/basic/DebugModeActivity.kt
CameraDebugView is not updating (lat, lon, etc.) on app start, But after minimize and return to app again app starts updating of CameraDebugView.

https://github.com/user-attachments/assets/6774ce0b-7254-4048-a96f-9e19483e0c24

Expected behavior

CameraDebugView should always show camera updates

Notes / preliminary analysis

CameraDebugView is not updating because on app start it does not have supscription to CameraChanged event due to DebugOptionsController has value started == false. Only in MapView.onStart() this value is setting to true but at first onStart next contdition is not met:

    if (debugOptionsControllerDelegate.isInitialized()) {
      debugOptionsController.started = true
    }

Workaround: call MapView.onStart() after setting debug options

                MapEffect(Unit) { mapView ->
                    mapView.debugOptions = setOf(
                        MapViewDebugOptions.CAMERA,
                    )
                    mapView.onStart()
                }

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 compose-app/src/main/java/com/mapbox/maps/compose/testapp/examples/basic/DebugModeActivity.kt and trace MapView.onStart(), DebugOptionsController.started, and CameraDebugView initialization. Reproduce with CAMERA debug options enabled and verify that CameraDebugView updates immediately on app start without requiring an additional lifecycle call.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.