Android

What to change in your app when moving the IMS Android SDK from 1.29.x to 2.0.x.

Migration Guide (Android 1.29.x → 2.0.x)

Sections are ordered for a typical integration.

1

Platform

minSdkVersion 29 (Android 10) or higher.

2

Initialization

Remove environment and region from SDK initialization.

Also remove any code that depends on environment or region from the SDK.

// Delete from the builder chain
.setSdkApiConfigEnvironment(...)
.setSdkApiConfigRegion(...)
3

Removed APIs

// Delete
ImsSdkManager.updateSdkConfig(context)

// Delete from the config builder
SdkConfigBuilder(...).apiKey(...)
4

Identity - drop apiKey

apiKey is no longer part of the IMS public API. Stop persisting or accessing it through Identity.

// Before
Identity(apiKey = apiKey, externalReferenceID = userId)
// After
Identity(externalReferenceID = userId)
5

Logging in a user

Call setIdentity once on login success — not on every onResume unless that genuinely represents a new login. If you observed currentIdentity via StateFlow, drop that pattern; the SDK no longer exposes it.

On isFailure, the user is not signed in to the SDK. Portal, trip detection, or other IMS APIs will not be available until setIdentity succeeds again.

// Before
val flow = ImsSdkManager.setIdentity(context, identityOrNull)
flow.collect { result ->
    when {
        result.isSuccess -> { }
        result.isFailure -> { }
    }
}
// After
lifecycleScope.launch {
    val result = ImsSdkManager.setIdentity(context, identity)
    when {
        result.isSuccess -> { }
        result.isFailure -> { }
    }
}
6

Logging out a user

clearIdentity is required on every logout in 2.0.x, and replaces the prior setIdentity(context, null) pattern.

The SDK persists identity across launches, so skipping this call leaves the previous user's identity in place — trip detection and Portal calls continue under that user until you call it.

Call it once per logout. It is a suspend function — call from a coroutine. Any SDK API call made after invoking this method will fail.

// Before
ImsSdkManager.setIdentity(context, null)
// After
lifecycleScope.launch {
    ImsSdkManager.clearIdentity(context)
}
7

Disabling Trip Detection

The deleteTripFiles flag is removed. For full logout and clearing local SDK user state, use ImsSdkManager.clearIdentity (see Android). Use disableTripManager only to stop detection.

// Before
ImsTripManager.disableTripManager(context, deleteTripFiles = true)
// After
ImsTripManager.disableTripManager(context)
8

AppMisuseManager

AppMisuse enable/disable handling is now managed internally by the SDK.

No replacement is needed. Other usage of AppMisuseManager, if any, are unaffected.

The two public toggles are gone:

// Delete
AppMisuseManager.enableAppMisuse(...)
AppMisuseManager.disableAppMisuse(...)

See also — new in 2.0.x (no migration required)

These additions are opt-in and require no changes to ship a working 2.0.x upgrade. Adopt them when you're ready:

Last updated