-
Notifications
You must be signed in to change notification settings - Fork 20
Migrate from Mobile Engage
- Why Emarsys SDK over Mobile Engage SDK?
- Migrate from Mobile Engage SDK
- Project Configuration
- Classes
- Methods
We learned a lot from running Mobile Engage SDK in the past 2 years and managed to apply these learnings and feedbacks in our new SDK. We would like to make sure we understand end to end the experience of your app users and give you some insights through the data platform.
- We removed anonymous contacts from our API. This way you can always send behaviour events, opens without having the complexity to login first with an identified contact or use hard-to-understand anonymous contact concept
- We can scale with our new stateless APIs in the backend We now include anonymous inapp metrics support
- We have improved the interoperability of our SDK with Swift. Using our SDK from Swift is now more convenient.
- We have improved the implementation workflow, so the energy is spent during the initial integration but not repeated during the life time of the app
- The Predict SDK, The Emarsys core SDK, the Mobile Engage SDK and the corresponding sample app are all now in a single repository. You can now find up to date and tested usage examples easily.
####Migrate from Mobile Engage SDK This is a guide on how to move from the Mobile Engage SDK to the new Emarsys SDK. This guide only covers the actual migration from the Mobile Engage SDK to the Emarsys SDK, please look at the README for more general details on how to get started with the Emarsys SDK.
In the Podfile configuration you need to remove the dependency to MobileEngage and the CoreSDK and add the new EmarsysSDK.
pod 'MobileEngageSDK'
pod 'CoreSDK'
↓
pod 'EmarsysSDK', :git => 'git@github.com:emartech/ios-emarsys-sdk.git', :tag => '1.99.0'
The MEEventHandler
interface was renamed to EMSEventHandler
.
class AppDelegate: UIResponder, UIApplicationDelegate, MEEventHandler {
...
}
↓
class AppDelegate: UIResponder, UIApplicationDelegate, EMSEventHandler {
...
}
Note
window
property must exists inAppDelegate
!
For the window
property please check the official Apple documentation as linked below:
See this link for more information.
The Emarsys SDK integrates Inapp, there is no need for any additional setting.
let config = EMSConfig.make { builder in
...
builder.setCredentialsWithApplicationCode(configuration.applicationCode, configuration.applicationPassword)
...
}
↓
let config = EMSConfig.make { builder in
...
builder.mobileEngageApplicationCode(configuration.applicationCode)
...
}
A call of MobileEngage.appLogin
without parameters is no longer necessary. You no longer login anonymously, instead upon registering your device, we will automatically create an anonymous contact if we never saw this device.
The workflow for linking a device to a contact was changed slightly. Instead of passing both the contactFieldId and the contactFieldValue when the user logs in, you now only need to send the contactFieldValue. The contactFieldId is set once during the configuration of the EmarsysSDK.
MobileEngage.appLogin(contactFieldId, contactFieldvalue)
↓
let config = EMSConfig.make { builder in
...
builder.setContactFieldId(contactFieldId)
...
}
Emarsys.setContactWithContactFieldValue(contactFieldValue)
MobileEngage.appLogout()
↓
Emarsys.clearContact()
MobileEngage.setPushToken(deviceToken)
↓
Emarsys.push.setPushToken(deviceToken)
If you were calling the setPushToken
method with null
in order to remove the token you need to change those calls to use the dedicated method removePushToken
instead.
MobileEngage.setPushToken(null)
↓
Emarsys.push.removePushToken()
MobileEngage.trackMessageOpen(userInfo)
↓
Emarsys.push.trackMessageOpen(userInfo)
The MobileEngage.statusDelegate
property was removed, you can now specify a completion block for each method instead.
MobileEngage.statusDelegate = self
↓
Emarsys.push.setPushToken(token) { (err) in
...
}