App Setup: Integrate with mParticle (Android - Gradle)


This article will provide guidance on how to integrate Leanplum in your mobile project using mParticle.

For mParticle Dashboard setup and information on which Leanplum features are supported by mParticle visit



Adding the integration

The Leanplum Kit requires that you add Leanplum's Maven server to your buildscript:

repositories {
maven { url "" }


Add the kit dependency to your app's build.gradle:

dependencies {
compile 'com.mparticle:android-leanplum-kit:4+'


Follow the mParticle Android SDK quick-start for any additional dependency to be added to your project.

Add the following to your Gradle dependecies necessary to collect the Android Advertisting ID:

compile ''


Add the following in your AndroidManifest Application class as well:

<receiver android:name="com.mparticle.ReferrerReceiver" android:exported="true">
<action android:name=""/>

For Leanplum, you will need Google Play Services in order to use Leanplum Push Services and Leanplum localization services. If you need those services, include also the following in your Gradle dependecies:

compile ''
compile ' location:9.0.0'

Rebuild and launch your app, and verify that you see"LeanplumKit detected" in the output of 'adb logcat'


Sample project

Android sample project is available here


Leanplum support

The mParticle SDK supported Leanplum features are:

  • Marketing Automation (i.e. In-App messages?)
  • A/B Testing (Messages only?)
  • Analytics (i.e. Tracking Events?)

Along with the mParticle SDK, the Leanplum SDK would also be accessible for using all the other Leanplum features not available out of the box through mParticle (for example setting Variables or Customizing Push Notifications).

To track events through mParticle, the suggested approach is to define a Custom Event. In that way also the parameters can be properly passed to Leanplum.

See the sample:

Map<String, String> eventInfo = new HashMap<String, String>(2);

eventInfo.put("spice", "hot");
eventInfo.put("menu", "weekdays");

MPEvent event = new MPEvent.Builder("Food Order", MParticle.EventType.Transaction)


Event name is in this case "Food Order" string.
The event parameters are passed as argument of info().


Was this article helpful?
Have more questions? Submit a request