GoogleMapsInitializer

A singleton object to manage the initialization of the Google Maps SDK.

This object provides a state machine to track the initialization process and ensures that the initialization is performed only once. It also provides a mechanism to reset the initialization state, which can be useful in test environments.

The initialization process consists of two main steps:

  1. Calling MapsInitializer.initialize(context) to initialize the Google Maps SDK.

  2. Calling MapsApiSettings.addInternalUsageAttributionId(context, attributionId) to add the library's attribution ID to the Maps API settings.

The state of the initialization is exposed via the state property, which is a State object that can be observed for changes.

Inheritors

Properties

Link copied to clipboard
abstract var attributionId: String

The value of the attribution ID. Set this to the empty string to opt out of attribution.

Link copied to clipboard

Functions

Link copied to clipboard
abstract suspend fun initialize(context: Context, forceInitialization: Boolean = false)

Initializes Google Maps. This function must be called before using any other functions in this library.

Link copied to clipboard
abstract suspend fun reset()

Resets the initialization state.