MoEngage Kit Integration
SDK Installation
Installing using Catalog
Integrating MoEngage SDK using a Version Catalog is the recommended way of integration, refer to the Configure Version Catalog document to configure a catalog if not done already. Once you have configured the catalog add the dependency in the app/build.gradle file as shown belowbuild.gradle
Dependencies Installation
MoEngage SDK depends on the following Jetpack libraries provided by Google for its functioning, make sure you add them if it isn’t already present in the application.build.gradle
Configure MoEngage SDK
Get Workspace ID (earlier App ID) from the Settings Page Dashboard —> Settings —> Account —> General and configure the MoEngage SDK in the Application class’s onCreate() before initializing the mParticle Kit.Add MoEngage SDK to mParticle SDK
MoEngage Kit needs to be added as a kit during initializing the mParticle SDK.Exclude MoEngage Storage File from Auto-Backup
The auto backup service of Andriod periodically backs up the Shared Preference file, Database files, and so on. For more information, refer to Auto Backup. The backup results in MoEngage SDK identifiers to be backed up and restored after re-install. The restoration of the identifier results in your data being corrupted and the user not being reachable using push notifications. To ensure data is not corrupted after a backup is restored, opt out of MoEngage SDK storage files. Refer to the Exclude MoEngage Storage File from Auto-Backup document to configure this.Handling Push Notifications
Copy the Server Key from the FCM console and add it to the MoEngage Dashboard (Not sure where to find the Server Key refer to Getting FCM Server Key. To upload it, navigate to MoEngage Dashboard —> Settings —> Channel —> Push —> Mobile Push —> Android and add the Server Key and package name.Adding metadata for push notification
Metadata regarding the notification is required to show push notifications where the small icon and large icon drawable are mandatory. Use the configureNotificationMetaData() to transfer the configuration to the SDK.Notification small icon should be flat, pictured face on, and must be white on a transparent background.
Configuring Firebase Cloud Messaging
Configuring with mParticle SDK
mParticle SDK provides a way to handle the registration of push token and receive push notifications at the mParticle SDK. Refer Push integration doc for the configuration option.Configuring with MoEngage SDK or with Application
Check the MoEngage Push integration doc to configure the FCM with MoEngage SDK or if you want to handle it independently. For more information on features provided in MoEngage Android SDK refer to the following links:- Push Notifications
- Geofence
- In-App messaging
- Notification Center
- Advanced Configuration
- API Reference
- Compliance
- Release Notes
mParticle SDK Usage
Refer to the developer documentation for detailed usage.User Management
User identity is managed through a combination of mParticle’s IDSync framework and MoEngage’s user profiles. Check IDSync documentation from the mParticle developer integration document to manage the user state in the application. By default, our integration automatically maps the following core mParticle identifiers to MoEngage user attributes without any extra code:- customerId
- mobileNumber
Mapping Additional Identifiers
To synchronise other identifiers (e.g., social media IDs, internal aliases), you must explicitly map them using the setMappingForIdentity(), method. This ensures that when an identifier is added or updated through an mParticle userIdentity API call, the change is reflected in the corresponding MoEngage user attribute.When to Call
This setup must be performed at a specific point in your app’s startup sequence:- After you initialize the MoEngage SDK.
- Before you call mParticle’s userIdentity API for the first time.