1. Home
  2. Developers
  3. 3rd Party Integration
  4. mParticle Integration: Android

mParticle Integration: Android

This document will guide you through setting up the Apptentive mParticle Kit through your existing mParticle integration. If you are not using mParticle, you should use the native integration documentation.

Please see our system requirements

Check out our example app.

1. Adding Apptentive to Your App

In your build.gradle, add the Apptentive mParticle kit alongside the mParticle core dependency

compile 'com.mparticle:android-apptentive-kit:4.16.6'

2. Set Up Apptentive in the mParticle Dashboard

Add Output: Apptentive

  1. If you haven’t already, create an Apptentive account, and create a new Android app in the Apptentive Dashboard
  2. In the mParticle Directory, click Apptentive
  3. Click +Add Apptentive to Setup
  4. Check the box Output: Event
  5. Click Add to Setup
  6. In the next screen, give your configuration the name Android
  7. Using the values found in Apptentive’s API & Development page, fill in the Apptentive API Key and Apptentive API Signature fields
  8. Click Save

Connect Android Input to the Apptentive Output

  • In the mParticle menu, click Connections
  • Under Available Inputs, click Android
  • Under Connected Outputs, click Connect Output
  • Click Apptentive
  • Select Configuration Android
  • Turn Status on to Sending
  • Click Add Configuration
Note

There may be a delay of several minutes before this configuration is downloaded by mParticle, and Apptentive is enable in your app.

3. Configure Events

If you have already been using mParticle in your app, you will most likely have calls to MParticle.logEvent(). These calls will be delegated through to Apptentive and the Event names you passed into logEvent() will be available for segmentation and targeting of Apptentive Interactions. If you haven’t already logged events in your app, you should do so now.

4. Configure Apptentive Interactions

Interactions can be configured to be displayed when mParticle events are logged by following these instructions.

5. Message Center

A vital part of our product is the ability to talk to your customers using Message Center. The mParticle API doesn’t have a concept of feedback or messaging, so you will need to call into our native SDK directly.

Apptentive.showMessageCenter()

You should find a place in your app where you can add a feedback button that will open Message Center. Because Apptentive may not be enabled via your mParticle dashboard, and because you may have disabled Message Center in the Apptentive dashboard, you should check for availability before you show your feedback button. Here is an example:

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  // Find your feedback button
  Button feedbackButton = findViewById(R.id.feedback_button);

  // Check whether Message Center is available
  boolean messageCenterEnabled = 
    MParticle.getInstance().isProviderActive(ServiceProviders.APPTENTIVE)
    && Apptentive.canShowMessageCenter();

  // Show or hide the feedback button
  if (messageCenterEnabled) {
    feedbackButton.setVisibility(View.VISIBLE);
  } else {
    feedbackButton.setVisibility(View.GONE);
  }

  // Open Message Center when the feedback button is clicked
  feedbackButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
      Apptentive.showMessageCenter(this);
    }
  });
}

6. Other Apptentive Features

Refer to the native Apptentive Android SDK documentation for all other Apptentive features.

Updated on September 29, 2017

Was this article helpful?

Related Articles