Android

Add dependencies

Add the following dependencies to the android/app/build.gradle file.

Add MoEngage Optional Library

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

Manually specify the version for the SDK artifact.

build.gradle
dependencies {
    ...
implementation("com.moengage:push-kit:<sdkVersion>")
}

Replace sdkVersion with the appropriate SDK version. To find the latest versions and compatible artifact combinations, please refer to the Installing SDK using Artifact Id.

Add Androidx Libraries

The SDK depends on a few Androidx libraries for its functioning, add the below Androidx libraries in your application if not done already.

build.gradle
dependencies {
    ...
implementation("androidx.core:core:1.6.0")
implementation("androidx.appcompat:appcompat:1.3.1")
implementation("androidx.lifecycle:lifecycle-process:2.7.0")
}

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, ensure the Initializer for the lifecycle-process library is also added. Refer to the documentation to know how to add the Initializer.

Previous

Next

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

How can we improve this article?