Migration Steps
Use these steps to migrate your app from the Engagement-specific React Native plugin to the React Native unified plugins.
- Remove the Marketing Cloud Engagement-specific package.
- Add the unified product package.
- To use the push or IAM feature packages, add them to your configuration.
- Reinstall iOS pods.
- Replace static
MCReactModuleusage with module initialization throughrequestSdk(). - Initialize required modules at app startup and reuse those instances.
requestSdk() caches the initialized SDK instance, so calling it again returns the same module instance.
- Update method calls based on module ownership and method renames.
| Engagement-specific React Native usage | React Native unified plugin usage | Module |
|---|---|---|
setContactKey, getContactKey | setProfileId, getProfileId | SFMCSdkModule |
setAttribute, getAttributes, track | same methods (moved) | SFMCSdkModule |
getSystemToken | getPushToken | PushModule |
getMessages, setMessageRead, deleteMessage | getAllMessages, markMessageRead, markMessageDeleted | MCModule |
tags, analytics, registration | module-specific methods | MCModule |
- Find references to previous plugin call sites and update them.
- Apply essential method renames:
getSystemToken->getPushTokensetMessageRead->markMessageReaddeleteMessage->markMessageDeleted
- Apply these additional required call-site updates:
- Replace analytics boolean setters with explicit methods:
setAnalyticsEnabled(true|false)->enableAnalytics()/disableAnalytics()setPiAnalyticsEnabled(true|false)->enablePiAnalytics()/disablePiAnalytics()
- Replace identity APIs:
setContactKey/getContactKey->setProfileId/getProfileId
- Update logging and SDK state handling:
enableLogging/disableLogging->setLogging('DEBUG'|'NONE')(or module-specific logging APIs)logSdkState()->getSdkState()and log the returned object in your app.
- Replace event classes from the previous plugin with unified event objects that use
objType.
- Validate event attribute value types. Unified event attributes supports these value types:
stringnumberboolean
- Convert unsupported payload values from the previous plugin before tracking.
If payload from the previous plugin contain nested objects, arrays, or null, convert them to supported value types.
- Remove unsupported event patterns from the previous plugin:
IdentityEventhas no direct equivalent in the unified model. Use core identity APIs instead.CustomEventcategory argument is not supported in unified event objects.
- Move listener logic to module emitters.
- Enable registration callback before subscribing.
Call setRegistrationCallback() before subscribing to registration events.
- Apply platform listener caveats:
- IAM event constants are exported via
IamEvent. - Engagement and push event names are subscribed using string event names.
- Push token refresh listener is Android-only.
- Inbox response listener behavior differs by platform; validate behavior on both Android and iOS.
- (Optional) Gate whether an in-app message displays.
Use this only if your app needs to allow or suppress in-app messages based on runtime logic.
- Update both native platforms to the module-based unified configuration model.
- Android: migrate
MainApplication.ktsetup to module-based config blocks. For more information about Android configuration, see Integrate the Android SDK. - iOS: migrate
AppDelegate.swiftsetup to module-based config blocks. For more information about iOS configuration, see Integrate the iOS SDK. - Reapply existing notification, URL-handling, and delegate customization in the new module configuration.
- Update Android native initialization using module-based configuration.
- Update iOS native initialization using module-based configuration.
- Verify mandatory platform configuration requirements.
- React Native New Architecture is enabled.
- Android build minimums match the required versions. For example, minSdk and compileSdk.
- Android 13+ push permission (
POST_NOTIFICATIONS) is requested for push flows. - iOS deployment target and Xcode minimums match the unified plugin requirements.
- Keep all existing notification, URL-handling, and delegate forwarding logic when porting to module-based initialization.
For more information, see Prerequisites.
- Find native initialization files and verify your final setup.