create

fun create(context: Context, apiKey: String, enableAnalytics: Boolean = false): CmSdk

Creates an instance of CmSdk and initializes it with the provided API key.

Note:

  • The instance created by this method is intended to be used as a singleton, calling the method repeatedly will produce different instances each time.

  • A valid API key is required to connect to Comodule modules. If necessary, the API key can be updated later using setApiKey.

Return

An instance of CmSdk.

Parameters

context

The context required for the SDK's operation, typically the application context.

apiKey

The API key required to authenticate the SDK and enable connections to Comodule modules.

enableAnalytics

Optional parameter to enable or disable Analytics and Crashlytics integration. If set to true, Firebase Crashlytics and Analytics will be initialized and enabled for the SDK instance. Crashlytics collects non-fatal SDK errors and reports them to the Firebase project of the client application. Analytics collects SDK-related events. No data is collected by Comodule.

The default value is false, meaning Analytics and Crashlytics will not be enabled unless explicitly requested.

See also