Skip to content

Migration guide from 4.x to 5.x

Davor Komušanac edited this page Dec 5, 2022 · 1 revision

Migration from 4.x to 5.x versions of the SDK

New versions of the SDK introduced breaking changes in API. New APIs were implemented to provide support for new features as well as to improve overall parity between the SDK, Infobip Portal and the platform. Below you should find a list of changes you will need to do in order to have same features available on the new version of the SDK.

API changes

Events API

Old name New name
MMNotificationUserDataSynced MMNotificationUserSynced
MMNotificationPrimaryDeviceSettingUpdated Obsolete. Get a persisted MobileMessaging.getInstallation() object or fetch it from the server with MobileMessaging.fetchInstallation(...). For more details see here

Installation API

Old API New API
MMInstallation class Installation class
MMInstallation.deviceToken Access level changed to internal
MobileMessaging.currentInstallation (returns MMInstallation class) MobileMessaging.getInstallation() (returns Installation class)
MMInstallation.syncInstallationWithServer(...), MMInstallation.syncPrimarySettingWithServer(...), MMInstallation.syncSystemDataWithServer(...) Obsolete, sync can be done either by pulling data from server with fetchInstallation or by pushing it to the server with saveInstallation, for more details see here

User API

Old API New API
MMUser class User class
MobileMessaging.currentUser (returns MMUser) MobileMessaging.getUser() (returns User)
MMUser.msisdn (returns String) User.phones (returns [String])
MMUser.email (returns String) User.emails (returns [String])
MMUser.externalId Moved to User.externalUserId
MMUser.birthdate Moved to User.birthday
MMUser.predefinedData Obsolete, use User properties
MMUserPredefinedDataKeys Obsolete, use User properties
CustomUserDataValue class ObsoleteCustomUserDataValue
MMUser.customData, MMUser.set(customData:forKey:) This functionality is now covered by Installation.customAttributes(sic!). Historically, the MMUser.customData was stored on the server within Destination model which is not the case now that custom attributes available on Person level as well.
MMUser.save(...) Logic was decoupled into MobileMessaging.saveUser(...) and MobileMessaging.personalize(...) methods to avoid potential problems with person merging and to clarify the intent of explicitly attaching existing device to the person, for more details see here
MMUser.fetchFromServer() Moved to MobileMessaging.fetchUser(...), for more details see here

MobileMessaging API

Old API New API
MobileMessaging.setAsPrimaryDevice(<value>) get current Installation (MobileMessaging.getInstallation()), set new value to Installation.isPrimaryDevice property and save installation. For more details see here
MobileMessaging.disablePushRegistration, MobileMessaging.enablePushRegistration get current Installation (MobileMessaging.getInstallation()), set new value to Installation.isPushRegistrationEnabled property and save installation. For more details see here
MobileMessaging.isPushRegistrationEnabled get current Installation (MobileMessaging.getInstallation()) and get Installation.isPushRegistrationEnabled property value
MobileMessaging.isPrimaryDevice get current Installation (MobileMessaging.getInstallation()), set/get Installation.isPrimaryDevice property value
MobileMessaging.logout(...) MobileMessaging.depersonalize(...), for more details see here
Clone this wiki locally