Android

Configuring Build Settings

Option 1: Using BOM (Recommended)

Use the Bill of Materials (BOM) to automatically manage compatible versions of the SDK modules.

build.gradle
dependencies {
    ...
    // Import the MoEngage BOM
    implementation(platform("com.moengage:android-bom:<bomVersion>"))
    
    // Add optional modules as needed
     implementation("com.moengage:inapp")
}

Replace <bomVersion> with the latest BOM version. For more info on integration using BOM, refer here.

Option 2: Manual Integration

Add Androidx Libraries

The MoEngage SDK depends on the lifecycle-process library for a few key features to work, and the latest version of lifecycle-process depends on the androidx.startup:startup-runtime library. Hence, do not remove the InitializationProvider component from the manifest. When adding other Initializers using the startup-runtime, make sure the Initializer for the lifecycle-process library is also added. Refer to the documentation to know how to add the Initializer.

The SDK also depends on a few Androidx libraries for its functioning. Add the below Androidx libraries in your application's build.gradle file or enable the required flag in the Package JSON file.

Configure in the Package JSON file

File - package.json

JSON
{
    "moengage": {
        "includeAndroidXRequiredLibraries": true
    }
}

Configure in the Gradle file

Skip this step if includeAndroidXRequiredLibraries flag is enabled in previous step.

Path - android/app/build.gradle(.kts)

Groovy

    dependencies {
    ...
      implementation("androidx.core:core:1.9.0")
      implementation("androidx.appcompat:appcompat:1.4.2")
      implementation("androidx.lifecycle:lifecycle-process:2.7.0")
    }
    

Feature Modules (optional)

To include optional modules from the MoEngage SDK based on your feature requirements, you can use the provided flags. By default, these modules are not included in your project.

File - package.json

JSON
{
    "moengage": {
        "richNotification": true,
        "_comment1": "Required for Push Templates",
       
        "encryption": true,
        "_comment2": "Required for Add-On-Security",
      
        "pushAmp": true,
        "_comment3": "Required for Push Amplification",
      
        "hmsPushkit": true,
        "_comment4": "Required for HMS PushKit",
      
        "deviceTrigger": true
        "_comment5": "Required for Device Triggered",
    }
}

Documentation For Optional Feature Flag

Previous

Next

Was this article helpful?
0 out of 5 found this helpful

How can we improve this article?