Skip to main content

Overview

This guide covers the parameters you can use to configure the MoEngage SDK. All plugin-level configuration is done within your app.json or app.config.js file. Core SDK credentials are placed in separate platform-specific files.
You must complete the installation guide before you configure the SDK.

Plugin-Managed Native Configuration

To ensure a reliable and streamlined setup, the MoEngage Expo plugin manages native project configurations automatically. This approach reduces the potential for manual errors by handling platform-specific requirements during the prebuild process. Key automations include:
  • Applying Critical Settings: The plugin automatically adds required settings, such as the Android backup exclusion rules, to ensure data integrity.
  • Eliminating Manual File Edits: Direct modification of native files like AndroidManifest.xml (for Android) or Info.plist (for iOS) is not necessary.

SDK Initialization Configuration (XML and Plist files)

As specified in the configFilePath property, your core MoEngage credentials and SDK settings do not go in app.json. Instead, they are defined in separate files for each platform.
  • For Android: Generate an XML file (e.g., android_initialisation_config.xml).
  • For iOS: Generate a Plist file (e.g., MoEngage-Config.plist).
The following tables detail the available properties for these files.
Android SDK Configuration
SectionField NameDescription
CoreMoengage Workspace IDThis field denotes the unique identifier that links your application to a specific workspace within your MoEngage dashboard.
CoreMoengage Project IDThis field denotes the unique identifier associated with a specific project if you have Portfolio feature enabled for your workspace.
CoreMoengage Data CenterThis field denotes the data center based on the dashboard URL. Refer here for more details.
CoreMoengageEnvironmentThis field denotes the environment for data reporting, such as LIVE for the live application or TEST for development, to prevent test data from affecting production analytics.
CoreCustom Proxy DomainThis field denotes the base custom proxy domain used to route SDK network traffic through your own subdomain. (Key: com_moengage_core_custom_base_domain)
CoreEnable Logging for Release buildThis field denotes whether to activate SDK logging in the production version of your app. It is recommended to disable this in release builds to improve performance and prevent exposure of sensitive data.
CoreLog LevelThis field denotes the verbosity of the logs generated by the SDK, typically ranging from detailed (VERBOSE = 0) to minimal (ERROR = 3), for debugging purposes.
CoreIntegration PartnerThis field denotes the name of any third-party integration partner you are using, which helps in attributing user acquisition or specific events to that partner.
CoreCache ConnectionThis field denotes the configuration for how the SDK caches data locally before sending it to MoEngage servers, helping to manage network usage and offline tracking.
Data TrackingTrack Device InformationThis field denotes whether the SDK should track standard device attributes such as the device model, OS version, GAID, and app version.
Data TrackingEnable Carrier TrackingThis field denotes whether the SDK should collect and send the user’s mobile carrier information (e.g., Verizon, T-Mobile) for segmentation.
Data TrackingEnable Screen Filtering by PackageThis field denotes whether to enable the package-based filtering specified in Screen Tracking Whitelisted Packages.
Data TrackingScreens to Exclude from TrackingThis field denotes a comma-separated list of Android Activity names to be excluded from automatic screen tracking, preventing data collection from sensitive or irrelevant screens.
Data TrackingEnable Background Data SyncThis field denotes whether the SDK is permitted to synchronize data with MoEngage servers while the application is running in the background.
Data TrackingEnable Periodic Data SyncThis field denotes the time interval in milliseconds at which the SDK syncs batched data with MoEngage servers if periodic sync is enabled.
Push NotificationPush Token Retry Interval(s)This field denotes the time interval in seconds that the SDK should wait before attempting to resend a push notification that failed to be delivered.
Push NotificationPush Notification Small IconThis field denotes the resource name of the drawable to be used as the small icon for all push notifications from your app.
Push NotificationPush Notification Large IconThis field denotes the resource name of the drawable to be used as the large icon for push notifications.
Push NotificationPush Notification ColorThis field denotes the hexadecimal color code (e.g., #FFFFFF) used to accent push notifications, affecting elements like the app name and action buttons.
Push NotificationGroup Multiple Notifications in DrawerThis field denotes the key used to group multiple notifications from your app into a single, stacked notification in the system tray.
Push NotificationEnable Push Notification Back Stack BuildingThis field denotes whether tapping a notification should rebuild the app’s task stack, ensuring proper back-button navigation.
Push NotificationEnable Notification Large Icon DisplayThis field denotes whether to show the specified large icon in push notifications.
Push NotificationEnable Heads-Up NotificationThis field denotes whether to allow high-priority notifications to appear as a floating “heads-up” banner at the top of the screen.
Push NotificationConfigure FCM RegistrationThis field denotes the server key from your Firebase Cloud Messaging (FCM) project, which is required to send push notifications to Android devices.
Push NotificationConfigure Huawei Push Kit RegistrationThis field denotes the app secret key from your Huawei Mobile Services (HMS) project, required for sending push notifications to Huawei devices.
Push NotificationEnable RTT Background SyncThis field denotes whether to enable Real-Time Triggers (RTT) background sync, allowing for more immediate campaign actions based on user behavior.
In-appsScreens to Suppress In-AppsThis field denotes a comma-separated list of Android Activity names on which in-app messages should not be displayed.
In-appsShow In-App in New ActivityThis field denotes whether in-app messages should be displayed within a new, dedicated Android Activity instead of overlaying the current one.
CardsCards Placeholder ImageThis field denotes a URL for a placeholder image that is displayed while the actual Card content is loading.
CardsCards Empty Inbox ImageThis field denotes a URL for an image to be displayed when the user’s Card inbox is empty.
CardsCards Date FormatThis field denotes the desired date format (e.g., “dd-MMM-yyyy”) for displaying timestamps on Card elements in the UI.
CardsEnable Swipe to Refresh the CardsThis field denotes whether users can pull down on the Card inbox screen to refresh its content.
SecurityEnable Storage EncryptionThis field denotes whether to encrypt the MoEngage data that is stored locally on the user’s device, enhancing data security.
SecurityEnable Network EncryptionThis field denotes whether to encrypt the data transmitted between the SDK and MoEngage’s servers, securing data in transit.
SecurityEnable JWT AuthorisationThis field denotes whether to enable JSON Web Token (JWT) based authorization for authenticating requests from the SDK to the MoEngage backend.

Configuration parameters

Add the properties listed below inside the react-native-expo-moengage plugin entry in your app.json or app.config.js file. These parameters control the plugin’s build-time behavior, such as linking native modules and pointing to your configuration files.
  1. Open your app.json or app.config.js file.
  2. Add react-native-expo-moengage to the plugins array.
[
        "react-native-expo-moengage",
        {
          "android": {
            "configFilePath": "assets/moengage/android_initilisation_config.xml",
            "smallIconPath": "assets/moengage/small_icon.png",
            "largeIconPath": "assets/moengage/large_icon.png",
            "disableMoEngageDefaultBackupFile": false,
            "includeFirebaseMessagingDependencies": true,
            "isExpoNotificationIntegration": true,
            "shouldIncludeMoEngageFirebaseMessagingService": true
          }
        }
]
KeyDescription
configFilePathSpecifies the path to the configuration file (.xml) containing your core MoEngage SDK settings.
smallIconPathSpecifies the path to the small icon to be used in push notification.
largeIconPathSpecifies the path to the large icon to be used in push notification.
disableMoEngageDefaultBackupFileMoEngage necessitates the exclusion of specific files during backup. This flag is designed to configure this process. If enabled, the configuration will be automatically included; otherwise, you need to add it manually. For more info, refer here.
includeFirebaseMessagingDependenciesThe plugin includes the Firebase Cloud Messaging (FCM) library required for push.
isExpoNotificationIntegrationSet to true to ensure compatibility and correctly route push payloads when using the expo-notifications library alongside the MoEngage notification service.
shouldIncludeMoEngageFirebaseMessagingServiceIf enabled, the notification service is included by MoEngage; otherwise, you must pass the payload to the MoEngage SDK.

Configure iOS App Extensions with EAS Build

EAS Build automatically handles standard iOS app configurations. However, if your app uses features that require separate native targets, you must configure them in eas.json. This includes features like:
  • Notification Service Extensions (NSE): used for rich push and impression tracking.
  • Notification Content Extensions (NCE): used for Push templates or Live Activities.
To configure iOS app extensions, add the appExtensions key to the expo.extra.eas.build.experimental.ios object. This configuration ensures EAS Build can correctly compile and sign the additional native targets.
{
  "expo": {
    "extra": {
      "eas": {
        "build": {
          "experimental": {
            "ios": {
              "appExtensions": [
                {
                  "targetName": "MoEngageExpoRichPush",
                  "bundleIdentifier": "${YOUR Bundle Identifier}.MoEngageExpoRichPush",
                  "entitlements": {
                    "com.apple.security.application-groups": ["${YOUR AppGroup provided in apple.configFilePath}"]
                  }
                },
                {
                  "targetName": "MoEngageExpoPushTemplates",
                  "bundleIdentifier": "${YOUR Bundle Identifier}.MoEngageExpoPushTemplates",
                  "entitlements": {
                    "com.apple.security.application-groups": ["${YOUR AppGroup provided in apple.configFilePath}"]
                  }
                },
                {
                  "targetName": "MoEngageExpoLiveActivity",
                  "bundleIdentifier": "${YOUR Bundle Identifier}",
                  "entitlements": {
                    "com.apple.security.application-groups": ["${YOUR AppGroup provided in apple.configFilePath}"]
                  }
                }
              ]
            }
          }
        }
      }
    }
  }
}

Generate the native project files

After installing the package and adding the plugin entry, you must run the prebuild command. This command uses your configuration to generate the native Android and iOS directories for your project. Run the following command:
npx expo prebuild

Next steps

After you’ve added your configuration, the final step is to initialize the SDK in your app’s code.