Skip to content

Migrate from Mobile Engage

Istvan Farkas edited this page Jul 15, 2019 · 11 revisions

Contents

Why Emarsys SDK over Mobile Engage SDK?

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.

The workflow for linking/unlinking a contact to a device was too complex
  • 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
The API is stateless
  • We can scale with our new stateless APIs in the backend. We now include anonymous in-app metrics support
Swift first approach
  • We have improved the interoperability of our SDK with Swift. Using our SDK from Swift is now more convenient.
Repetition of arguments
  • 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
Unification of github projects
  • 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.

Project Configuration

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'

Classes

Protocol renamed

The MEEventHandler interface was renamed to EMSEventHandler.

class AppDelegate: UIResponder, UIApplicationDelegate, MEEventHandler {
  ...
}

class AppDelegate: UIResponder, UIApplicationDelegate, EMSEventHandler {
  ...
}

AppDelegate window property

Note

window property must exists in AppDelegate!

For the window property please check the official Apple documentation as linked below:

See this link for more information.

Methods

setExperimentalFeatures

The Emarsys SDK integrates Inapp, there is no need for any additional setting.

setCredentialsWithApplicationCode

let config = EMSConfig.make { builder in
  ...
  builder.setCredentialsWithApplicationCode(configuration.applicationCode, configuration.applicationPassword)
  ...
}

let config = EMSConfig.make { builder in
  ...
  builder.mobileEngageApplicationCode(configuration.applicationCode)
  ...
}

appLogin()

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.

appLogin(contactFieldId, contactFieldvalue)

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 Emarsys SDK.

MobileEngage.appLogin(contactFieldId, contactFieldvalue)

let config = EMSConfig.make { builder in
  ...
  builder.setContactFieldId(contactFieldId)
  ...
}

Emarsys.setContactWithContactFieldValue(contactFieldValue)

appLogout

MobileEngage.appLogout()

Emarsys.clearContact()

setPushToken

MobileEngage.setPushToken(deviceToken)

Emarsys.push.setPushToken(deviceToken)

setPushToken(null)

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()

trackMessageOpen(info)

MobileEngage.trackMessageOpen(userInfo)

Emarsys.push.trackMessageOpen(userInfo)

statusDelegate

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
  ...
}
Clone this wiki locally