SDK lifecycle


Initialization


This method initializes Synerise.

This method must be called before any other Synerise SDK method and only once during the application's lifecycle.

Declared In:
lib/main/Synerise.js

Related To:
Synerise
SyneriseInitializer

Class:
PromotionsModule

Builder Parameters:

Parameter Type Mandatory Default Description
withBaseUrl string no - Synerise API custom environment base URL
withApiKey string yes - Synerise Profile (formerly Client) API Key
withDebugModeEnabled boolean no - Enables or disables console logs
withCrashHandlingEnabled boolean no - Enables or disables crash handling
withSettings object no - Settings that have to be configured before Synerise is initialized

Before version 1.0.0, the withApiKey method was called withClientApiKey.

Return Value:
No value is returned.

Example:

Synerise.Initializer()
  .withBaseUrl("YOUR_API_BASE_URL")
  .withApiKey('YOUR_PROFILE_API_KEY')
  .withDebugModeEnabled(true)
  .withCrashHandlingEnabled(true)
  .withSettings({
    sdk: {
      enabled: true
    })
    .init();

Change Profile API key dynamically


This method changes a Profile (formerly Client) API key dynamically. Declared In:
lib/main/Synerise.js

Declaration:

public static changeApiKey(ApiKey: string, config?: InitializationConfig | undefined)

Before version 1.0.0, this method was called changeClientApiKey.

Parameters:

Parameter Type Mandatory Default Description
apiKey string yes - New API key
config InitializationConfig no - Object for additional initialization settings after the API key change

Return Value:
No value is returned.

Example:

Synerise.changeApiKey(apiKey);

Change Profile API Key dynamically with config


This method changes a Profile (formerly Client) API key dynamically, with additional parameters. It can include a salt for Simple Profile Authentication requests.

iOS SDK Android SDK React Native SDK Flutter SDK
Introduced in: 4.19.0 5.20.0 0.23.0 1.3.0
Declared In:
lib/main/Synerise.js

Declaration:

public static changeApiKey(ApiKey: string, config?: InitializationConfig | undefined)

Before version 1.0.0, this method was called changeClientApiKey.

Parameters:

Parameter Type Mandatory Default Description
apiKey string yes - New API key
config InitializationConfig no - Object for additional initialization settings after the API key change

Return Value:
No value is returned.

Example:

Synerise.changeApiKey(apiKey);

Canonical URL: https://hub.synerise.com/developers/mobile-sdk/method-reference/react-native/lifecycle