Skip to content
szabist edited this page Mar 17, 2021 · 16 revisions

What is Config?

Emarsys SDK now provides a solution for applicationCode, contactFieldId and merchantId change in a convenient way, without restarting the SDK.

Note

Please keep in mind, if any error occurs during the change process the involved feature will be turned off.

Use cases of applicationCode change

Note

When changeApplicationCode has been called, the SDK will log out the user and a setContact(contactFieldValue) must be called again with the correct contactFieldValue.

  1. Turn on Mobile Engage feature

    There was no applicationCode set in the SDK before and with Config it can be set from null to a valid code.

Note

In that case when the SDK was setup with null applicationCode, the developer is responsible to call setPushToken with the valid pushToken if it was received during when the SDK was in inactive state

  1. Turn off Mobile Engage feature

    Erase a previously set applicationCode and disable the feature by setting it to null.

  2. Use a different applicationCode

    Change a previously set applicationCode to a new one. If there was a pushToken set, the SDK saves it, calls clearPushToken before executing the applicationCode change and restore the original pushToken under the new applicationCode.

  3. Use a different contactFieldId

    Change a previously set contactFieldId, to use a different contactField for authentication.

Use cases of merchantId change

  1. Turn on Predict feature

    There was no merchantId set in the SDK before and with Config it can be set from null to a valid merchantId.

  2. Turn off Predict feature

    Erase a previously set merchantId and disable the feature by setting it to null.

  3. Use a different merchantId

    Change a previously set merchantId to a new one.

changeApplicationCode

Note

If any error occurs during the change process the Mobile Engage feature will be turned off.

Java
Emarsys.getConfig().changeApplicationCode(String applicationCode);
Kotlin
Emarsys.config.changeApplicationCode(applicationCode: String?, completionListener: CompletionListener? = null)

contactFieldId could also be changed in the same pattern, by defining it as a method parameter.

Java
Emarsys.getConfig().changeApplicationCode(String applicationCode, Int contactFieldId);
Kotlin
Emarsys.config.changeApplicationCode(applicationCode: String?, contactFieldId: Int, completionListener: CompletionListener? = null)

Errors can be handled inside an optional CompletionListener added to the method call.

changeMerchantId

Java
Emarsys.getConfig().changeMerchantId(String merchantId);
Kotlin
Emarsys.config.changeMerchantId(merchantId: String?)

applicationCode

Provides what is the actual applicationCode set in the SDK.

Java
Emarsys.getConfig().getApplicationCode();
Kotlin
Emarsys.config.applicationCode

merchantId

Provides what is the actual merchantId set in the SDK.

Java
Emarsys.getConfig().getMerchantId();
Kotlin
Emarsys.config.merchantId

contactFieldId

Provides what is the actual contactFieldId set in the SDK.

Java
Emarsys.getConfig().getContactFieldId();
Kotlin
Emarsys.config.contactFieldId

hardwareId

Provides what is the actual hardwareId used by the SDK.

Java
Emarsys.getConfig().getHardwareId();
Kotlin
Emarsys.config.hardwareId

language

Provides what is the actual language of the application.

Java
Emarsys.getConfig().getLanguage();
Kotlin
Emarsys.config.language

notificationSettings

Provides what is the actual notificationSettings set for the application.

Java
Emarsys.getConfig().getNotificationSettings();
Kotlin
Emarsys.config.notificationSettings

automaticPushSendingEnabled

Provides if automaticPushSendingEnabled is enabled for the application.

Java
Emarsys.getConfig().isAutomaticPushSendingEnabled();
Kotlin
Emarsys.config.automaticPushSendingEnabled

sdkVersion

Provides the sdkVersion of the application.

Java
Emarsys.getConfig().getSdkVersion();
Kotlin
Emarsys.config.sdkVersion
Clone this wiki locally