mixpanel / sample-android-mixpanel-integration

58 stars 35 forks source link

Sample Android Application for Mixpanel Integration

This repository contains a sample application demonstrating how you can use Mixpanel in your Android apps.

Getting Started

The sample application can be build using Android Studio.

Using Android Studio

Integration in Android Studio is very simple.

You should now be able to run the sample application

You will also need to add your Mixpanel API token and your Android Push Sender id to the source code, and enable Mixpanel to send Google Cloud Messages on your behalf.

Add your Mixpanel Token to your code and google-services.json file to your project

There is one value in MainActivity.java that you'll need to update before you can send data to Mixpanel. You'll need to update the source code with your Mixpanel API Token to send data.

For Your Mixpanel Token

Change the value of MainActivity.MIXPANEL_API_TOKEN to the value you copied from the web page.

For enabling push notifications using FCM

Set up Firebase Cloud Messaging services in Mixpanel

To send Firebase Cloud Messages, you will also have to connect Mixpanel to your Google APIs account. To do this you'll need to make sure Cloud Messaging is enabled, and provide an FCM Server key to Mixpanel

This process is documented in more detail, including screenshots, at

https://mixpanel.com/docs/people-analytics/android-push

To Provide your Firebase Server Key to Mixpanel

Once you've added your keys to the source code and set up Mixpanel to send Firebase Cloud Messages, you're ready to build and deploy your application.

Getting More Information

The Mixpanel Android integration API documentation is available on the Mixpanel website.

For an overview of Mixpanel Android library features : https://mixpanel.com/help/reference/android

For details about setting up and implementing Google Cloud Messaging Notifications : https://mixpanel.com/help/reference/android-push-notifications

For a detailed Android API reference : http://mixpanel.github.io/mixpanel-android/index.html