Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CameraDebugView is not updating on app start #2539

Open
anisart opened this issue Dec 6, 2024 · 1 comment
Open

CameraDebugView is not updating on app start #2539

anisart opened this issue Dec 6, 2024 · 1 comment
Labels
bug 🪲 Something isn't working

Comments

@anisart
Copy link

anisart commented Dec 6, 2024

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.

screen-20241206-111412.mp4

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

@anisart anisart added the bug 🪲 Something isn't working label Dec 6, 2024
@anisart
Copy link
Author

anisart commented Dec 6, 2024

After some additional analysis I found that:

  1. It's reproducible only in Compose style code
  2. MapView.onStart() is called from MapViewLifecycle very early before MapView.debugOptions is set. While in View style MapView.onStart() is called from MapboxLifecyclePluginImpl when MapView.debugOptions is already set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant