Class MapsInitializerKt
-
- All Implemented Interfaces:
public final class MapsInitializerKt
-
-
Method Summary
Modifier and Type Method Description final static MapsInitializer.RendererawaitMapsSdkInitialized(Context $self, MapsInitializer.Renderer preferredRenderer)Suspends until the Google Maps SDK is initialized and returns the MapsInitializer.Renderer that was actually loaded. -
-
Method Detail
-
awaitMapsSdkInitialized
final static MapsInitializer.Renderer awaitMapsSdkInitialized(Context $self, MapsInitializer.Renderer preferredRenderer)
Suspends until the Google Maps SDK is initialized and returns the MapsInitializer.Renderer that was actually loaded.
Purpose: Provides a modern coroutine suspension alternative to MapsInitializer.initialize with callback handlers, enabling clean, sequential asynchronous SDK initialization.
How it works: Invokes MapsInitializer.initialize passing an com.google.android.gms.maps.OnMapsSdkInitializedCallback. When the callback fires, it resumes the coroutine with the loaded MapsInitializer.Renderer. If the SDK returns an error status code other than ConnectionResult.SUCCESS and does not invoke the callback, it resumes with GooglePlayServicesNotAvailableException holding the error code.
Cancellation: This suspending function supports standard coroutine cancellation. Note that the underlying Maps SDK MapsInitializer.initialize operation cannot be cancelled once initiated. Only the first Maps SDK initialization in an application lifecycle honors preferredRenderer; passing
nulluses the SDK's default preference.- Parameters:
preferredRenderer- the renderer to request, ornullto use the SDK default preference- Returns:
the MapsInitializer.Renderer actually loaded by the Maps SDK
-
-
-
-