diff --git a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt index 9bffa18ea9f845377bb05dd469bdcccad48014ba..a35cf1c69fe33e1c5aa76992b073ee68439be396 100644 --- a/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt +++ b/play-services-maps-core-mapbox/src/main/kotlin/org/microg/gms/maps/mapbox/GoogleMap.kt @@ -120,6 +120,8 @@ class GoogleMapImpl(context: Context, var options: GoogleMapOptions) : AbstractG val waitingCameraUpdates = mutableListOf() var locationEnabled: Boolean = false + var isStarted = false + init { BitmapDescriptorFactoryImpl.initialize(mapContext.resources, context.resources) LibraryLoader.setLibraryLoader(MultiArchLoader(mapContext, context)) @@ -459,7 +461,15 @@ class GoogleMapImpl(context: Context, var options: GoogleMapOptions) : AbstractG Log.e(TAG, "snapshot could not be taken because map is null") runOnMainLooper { callback.onBitmapWrappedReady(ObjectWrapper.wrap(null)) } } else { - Log.d(TAG, "taking snapshot") + if (!isStarted) { + Log.w(TAG, "Caller did not call onStart() before taking snapshot. Calling onStart() now, for snapshot not to fail.") + // Snapshots fail silently if onStart had not been called. This is the case with Signal. + onStart() + isStarted = true + } + + Log.d(TAG, "taking snapshot now") + map.snapshot { runOnMainLooper { Log.d(TAG, "snapshot ready, providing to application") @@ -787,10 +797,12 @@ class GoogleMapImpl(context: Context, var options: GoogleMapOptions) : AbstractG } override fun onStart() { + isStarted = true mapView?.onStart() } override fun onStop() { + isStarted = false mapView?.onStop() }