Android Quickstart

Welcome to mParticle! Let’s send your first event.

Step 1: Generate your API key

Open your workspace and generate Android API credentials on the Setup page.

Step 2: Add the SDK to your project

Add our SDK to your build.gradle file:

dependencies {
    // Alternatively, you can target a specific version
    implementation 'com.mparticle:android-core:5+'

Step 3: Initialize the SDK

Initialize the SDK in the onCreate() method of your app’s Application or MainActivity class.

//import mParticle
import com.mparticle.MParticle
import com.mparticle.MParticleOptions

class ExampleApplication : Application() {
    override fun onCreate() {
        var options = MParticleOptions.builder(this)
            .credentials("YOUR_API_KEY", "YOUR_API_SECRET")
//import mParticle
import com.mparticle.MParticle;
import com.mparticle.MParticleOptions;

public class ExampleApplication extends Application {

    public void onCreate() {
        MParticleOptions options = MParticleOptions.builder(this)
                .credentials("YOUR_API_KEY", "YOUR_API_SECRET")

Step 4: Verify installation

Go to your Live Stream and watch new Session events come in as you load your app in the emulator.

Next Steps

🎉🎉🎉 Congrats on sending your first event to mParticle!

Some ideas on what to do next:

Was this page helpful?