getInstance

fun getInstance(applicationContext: Context, key: String? = DEFAULT_KEY, enableDebugLogging: Boolean = true): StorytellerGamModule

Returns a singleton instance of StorytellerGamModule.

This method ensures that only one instance of StorytellerGamModule is created per key. If an instance for the given key does not exist, a new one will be created and stored. Subsequent calls with the same key will return the existing instance.

It also configures the GamLogger based on the enableDebugLogging flag. For module setup instructions, refer to the Storyteller Ads Documentation.

Return

The singleton instance of StorytellerGamModule for the given key.

Parameters

applicationContext

The application Context. This is used to initialize the module and access application-level resources. It's important to use the application context to avoid memory leaks.

enableDebugLogging

A Boolean flag to enable or disable debug logging for the GAM module. Defaults to true. When true, detailed logs will be outputted by GamLogger.