Goal
Migrate an existing Engage v6 Android SDK implementation to Engage v7 by updating SDK usage patterns, APIs, and behaviors.
Background Information & Prerequisites
This migration applies to Android applications currently using the Engage v6 SDK.
Before starting the migration:
Engage is already integrated into your Android application.
You are familiar with your existing Engage v6 implementation.
The Engage v7 SDK is available for your project.
Procedure
Initializing the SDK
The initialization call remains the same in v6 and v7. However, SDK behavior changes in v7.
v6
Appoxee.engage(application, options)
val sdk = Appoxee.instance()v7
Appoxee.engage(application, options)
val sdk = Appoxee.instance()In Engage v7, calling instance() throws an exception if engage() was not called first.
Handling SDK Readiness
SDK readiness checks are updated to use observers instead of init listeners.
v6
if (sdk.isReady()) {
// safe to use
}
sdk.addInitListener { ready -> ... }v7
if (sdk.isReady()) {
// safe to use
}
sdk.subscribe(observer) // observer implements AppoxeeObserver
sdk.unsubscribe(observer)Managing Aliases
Alias handling becomes asynchronous in Engage v7.
v6
sdk.setAlias("user123")
val alias = sdk.getAlias()v7
sdk.setAlias("user123", resendCustomAttributes = false)
.enqueue { result -> println("alias set to $result") }
sdk.getAlias()
.enqueue { alias -> println("alias = $alias") }Managing Tags
Tag operations now accept lists and return asynchronous results.
v6
sdk.addTag("vip")
sdk.removeTag("vip")
val tags = sdk.getTags()v7
sdk.addTags(listOf("vip"))
.enqueue { ok -> println("added: $ok") }
sdk.removeTags(listOf("vip"))
.enqueue { ok -> println("removed: $ok") }
sdk.getTags()
.enqueue { tags -> println("List of tags: $tags") }Managing Custom Attributes
Custom attribute handling changes in Engage v7, including attribute removal behavior.
v6
sdk.setAttributes(mapOf("age" to 30))
val age = sdk.getAttributeStringValue("age")
sdk.removeAttribute("age")v7
sdk.addCustomAttributes(mapOf("age" to 30))
.enqueue { ok -> println("set age: $ok") }
sdk.getCustomAttributes(listOf("age"))
.enqueue { attrs -> println("age = ${attrs["age"]}") }
// removeAttribute() removed, overwrite with null
sdk.addCustomAttributes(mapOf("age" to null))Updating Push Messaging
Push messaging APIs in Engage v7 are asynchronous and include additional helper methods.
v6
val enabled = sdk.isPushEnabled()
sdk.setPushEnabled(true)
sdk.setToken(token)
sdk.setRemoteMessage(remoteMessage)v7
sdk.isPushEnabled()
.enqueue { enabled -> println("push enabled? $enabled") }
sdk.enablePush(true)
.enqueue { ok -> println("enabled: $ok") }
sdk.getFirebaseToken()
.enqueue { token -> println("firebase token: $token") }
sdk.handlePushMessage(remoteMessage)
val isMapp = sdk.isPushMessageFromMapp(remoteMessage)
sdk.updateFirebaseToken(newToken)
sdk.setPushBroadcast(MyPushReceiver::class.java)
sdk.closeNotification(notificationId)Configuring Geofencing
Geofencing APIs have been updated to return asynchronous results.
v6
sdk.startGeoFencing(callback)
sdk.stopGeoFencing(callback)
val active = sdk.isGeofencingActive()v7
sdk.startGeofencing(enterDelaySeconds = 0)
.enqueue { status -> println("geo started: $status") }
sdk.stopGeofencing()
.enqueue { status -> println("geo stopped: $status") }
sdk.isGeofencingActive()
.enqueue { active -> println("active? $active") }Triggering In-App Messages
The trigger method now requires an Activity and returns an asynchronous result.
v6
sdk.triggerInApp(context, "purchase_complete")v7
sdk.triggerInApp(activity, "purchase_complete")
.enqueue { shown -> println("trigger success? $shown") }Working with Inbox Messages
Inbox APIs return asynchronous responses and include additional helper methods.
v6
sdk.fetchInboxMessages()
sdk.fetchInboxMessage(templateId)v7
sdk.fetchInboxMessages()
.enqueue { response -> println("messages: ${response?.messages}") }
sdk.fetchInboxMessage(templateId)
.enqueue { msg -> println("message: $msg") }
sdk.fetchLatestInboxMessage()
.enqueue { msg -> println("latest: $msg") }
sdk.showInboxMessage(activity, message)
sdk.updateInboxMessageStatus(message, MessageStatus.READ)
.enqueue { ok -> println("status updated: $ok") }Logging Out
Logout behavior is asynchronous in Engage v7.
v6
sdk.logOut(true)v7
sdk.logout(pushEnabled = true)
.enqueue { ok -> println("logout: $ok") }Accessing Device Information
Device information retrieval is now via an asynchronous API.
v6
val info = sdk.getDeviceInfo()
val last = sdk.getLastActivity()v7
sdk.getDevice()
.enqueue { device -> println("device: $device") }