Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit

Bumps org.jlleitschuh.gradle.ktlint from 11.0.0 to 11.1.0.

- dependency-name: org.jlleitschuh.gradle.ktlint
  dependency-type: direct:production
  update-type: version-update:semver-minor

Signed-off-by: dependabot[bot] <>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]>

Git stats


Failed to load latest commit information.
Latest commit message
Commit time
January 5, 2023 18:18
April 3, 2017 16:57
January 5, 2023 18:34
January 31, 2018 14:07
January 5, 2023 18:34

Android SDK

Maven Central Status

Hello! This is the public repo of the mParticle Android SDK. mParticle's mission is straightforward: make it really easy to use all of the great services in the app ecosystem. Our SDKs and platform are designed to be your abstraction layer and data hub, and we do the work of integrating with each individual app service so you don't have to.

The platform has grown to support 100+ partners in the ecosystem, including developer tools, analytics, attribution, marketing automation, and advertising services. We also have a powerful audience engine that sits atop our platform to let you action on all of your data - learn more here!

Core SDK

mParticle's Android integration is powered by a Core library, which supports mParticle's server-side integrations and audience platform.

You can grab the Core SDK via Maven Central. Please see the badge above and follow the releases page to stay up to date with the latest version.

dependencies {
    implementation 'com.mparticle:android-core:5.49.0'


Several integrations require additional client-side add-on libraries called "kits." Some kits embed other SDKs, others just contain a bit of additional functionality. Kits are designed to feel just like server-side integrations; you enable, disable, filter, sample, and otherwise tweak kits completely from the mParticle platform UI. The Core SDK will detect kits at runtime, but you need to add them as dependencies to your build:

dependencies {
    implementation (

Kits are deployed as individual artifacts in Maven Central, and each has a dedicated repository if you'd like to view the source code. Review the table below to see if you need to include any kits:

Kit Maven Artifact
Adjust android-adjust-kit
Adobe android-adobe-kit
AdobeMedia android-adobemedia-kit
Appboy android-appboy-kit
AppsFlyer android-appsflyer-kit
Apptentive android-apptentive-kit
Apptimize android-apptimize-kit
Apteligent android-apteligent-kit
Blueshift android-blueshift-kit
Branch Metrics android-branch-kit
Button android-button-kit
CleverTap android-clevertap-kit
ComScore android-comscore-kit
Flurry android-flurry-kit
ForeSee android-foresee-kit
Google Analytics for Firebase android-googleanalyticsfirebase-kit
Google Analytics for Firebase - GA4 android-googleanalyticsfirebasega4-kit
Iterable android-iterable-kit
Kochava android-kochava-kit
Leanplum android-leanplum-kit
Localytics android-localytics-kit
Neura android-neura-kit
OneTrust android-onetrust-kit
Optimizely android-optimizely-kit
Pilgrim android-pilgrim-kit
Radar android-radar-kit
Responsys android-responsys-kit
Reveal Mobile android-revealmobile-kit
Singular android-singular-kit
Skyhook android-skyhook-kit
Swrve android-swrve-kit
Taplytics Mobile android-taplytics-kit
Tune android-tune-kit
Urban Airship android-urbanairship-kit
Wootric android-wootric-kit
Google Play Services Ads

The Google Play Services Ads framework is necessary to collect the Android Advertisting ID. AAID collection is required by all attribution and audience integrations, and many other integrations. Include the -ads artifact, a subset of Google Play Services:

    implementation ''

If your app does not declare this permission when targeting Android 13 or higher, the advertising ID is automatically removed and replaced with a string of zeroes.

When apps target Android 13 or above, you will need to declare a Google Play services permission in the manifest file as follows:

    <uses-permission android:name=""/>

For more information, please check out this link:

Firebase Cloud Messaging

mParticle supports several marketing automation and push messaging integrations. These require that mParticle register for an instance id using the Firebase Cloud Messaging framework:



Google Play Install Referrer

In order for attribution, deep linking, and many other integrations to work properly, the mParticle SDK collects the Google Play Install referrer string, which tracks the original link that brought the user to Google Play.

Since google has deprecated the "INSTALL_REFERRER" broadcast intent, you will need to add a the Play Install Referrer Library

Play Install Referrer Library

Google now supports a library that surface the referrer string:

Simply add this dependency to your app and the mParticle SDK will detect it:

implementation ''

Initialize the SDK

  1. Grab your mParticle key and secret from your workspace's dashboard and construct an MParticleOptions object.

  2. Call start from the onCreate method of your app's Application class. It's crucial that the SDK be started here for proper session management. If you don't already have an Application class, create it and then specify its fully-qualified name in the <application> tag of your app's AndroidManifest.xml.

package com.example.myapp;

import com.mparticle.MParticle;

public class MyApplication extends Application {
    public void onCreate() {
        MParticleOptions options = MParticleOptions.builder(this)
            .credentials("REPLACE ME WITH KEY","REPLACE ME WITH SECRET")
                new BaseIdentityTask()


Warning: It's generally not a good idea to log events in your Application.onCreate(). Android may instantiate your Application class for a lot of reasons, in the background, while the user isn't even using their device.


Proguard is a minification/optimization/obfuscation tool that's extremely useful, and it can also cause some sticky bugs. The mParticle SDK is already minified so there's no need to...double-minify it. If you're using Gradle there's nothing to do - we include a consumer-proguard rules file inside our AAR which Gradle will automatically include in your build. If you're not using Gradle, please add those same rules manually - see here for the latest.

Data Planning (beta)

requires node and npm

The Android SDK provides the ability to enforce your Data Plan via linting. Currently, this feature is beta-level, but it only runs in the build environment, so there is no chance that it affects the runtime behavior of the mParticle SDK.

To enable Data Plan validation via linting, you must first download your Data Plan according to these steps

We recommended you add the Data Plan in your application's root level directory, but it can be located anywhere in your project directory since dataPlanFile accepts a relative file path

1) Add the mParticle Gradle Plugin

The next step is to configure the mParticle Gradle Plugin. In your root build.gradle use the following code to add the plugin dependency to your buildscript:

buildscript {
    repositories {
    dependencies {
        classpath 'com.mparticle:android-plugin:5.12.10'

Next, apply the plugin in your project-level build.gradle

apply plugin: 'com.mparticle'
2) Configure the Plugin

Either configure the mParticle Plugin object

mparticle {
    dataPlanFile 'mp-dataplan.json'     //(required) accepts filename or path

    resultsFile 'mp-dp-results.json'    //(optional) accepts filename or path
    disabled false                      //(optional) defaults to "false"
    verbose false                       //{optional) defaults to "false"


provide an mp.config config file in the project-level directory

    "dataPlanFile": "./mp-dataplan.json",      //(required) accepts filename or path
    "resultsFile": "./mp-dp-results.json",     //(optional) accepts filename or path
    "disabled": "false",                       //(optional) defaults to "false"
    "verbose": false                           //(optional) defaults to "false"
3) Install the mParticle CLI tool

Install the mParticle CLI. More documentation is available in it's Github repo

./gradlew mpInstall
4) Viewing results

Note: Any changes to your dataplan are not applied until the Gradle Project Syncs

Validation Errors surface in multiple locations.

  • Individual Errors in the IDE as linting errors (red squiggly underlines), marking the offending code.
  • Written to your resultsFile, if you configured one in the mParticle plugin
  • Within the terminal, run ./gradlew lint

Custom Lint Checks

This SDK contains a number of custom link checks. These are designed to make the development process simpler and more integrated.

If at any time, they become too intrusive, they can easily switch off by including the Lint ID in the following block of your build.gradle:

android {
    lintOptions {
        disable {LINT_ISSUE_ID_1}, {LINT_ISSUE_ID_2}, {LINT_ISSUE_ID_3}...
Lint Issue ID Description
MParticleVersionInconsistency mParticle dependencies should, but do not have, matching versions
MParticleInitialization mParticle.start() is not being called in Application.onCreate(), or may be being called multiple times
MParticleInstallRefReceiver ReferrerReceiver is present, but has been removed
Data Planning
Lint Issue ID Description
DataplanViolation DataPlan violations
NodeMissing The required node dependency is not present in the $PATH variable
DataPlanMissing Unable to fetch you DataPlan, could be a problem with credentials or network connectivity

Downloading and configuring the mParticle Kits

For information on regarding this topic please read our Onboarding Document

Read More

Just by initializing the SDK you'll be set up to track user installs, engagement, and much more. Check out our doc site to learn how to add specific event tracking to your app.


Apache License 2.0