Skip to content

v4.0.0

Compare
Choose a tag to compare
@joeatwork joeatwork released this 12 Feb 01:38
· 1845 commits to master since this release

A major release of the Mixpanel Android Library, with a bunch of new features, including some possibly backward breaking changes.

New Features

Support for getPeople().union(), getPeople().setOnce() and getPeople().unset() has been added.

These are all new methods on the MixpanelAPI.People object.

Support for Mixpanel surveys.

Support takes the form of two new API calls
and some new default automatic behavior

  • MixpanelAPI.getPeople().checkForSurveys will query Mixpanel for surveys
    targeted to the current user, and pass a Survey object
    to a callback when a survey is found, or null if no Survey could be found
  • MixpanelAPI.getPeople().showSurvey will launch a new Activity that shows
    the given survey to the user, and send the results of the survey to Mixpanel
  • Unless configured with com.mixpanel.android.MPConfig.AutoCheckForSurveys metadata,
    applications using the Mixpanel library will automatically query for and show
    an available survey on application startup.

Automatic referrer tracking from the Google Play Store

Adding the following to the main tag in your AndroidManfest.xml will automatically set super properties associated with the referrer to your Google Play Store listing:

<receiver android:name="com.mixpanel.android.mpmetrics.InstallReferrerReceiver"
        android:exported="true">
  <intent-filter>
      <action android:name="com.android.vending.INSTALL_REFERRER" />
  </intent-filter>

Manifest metadata for library configuration

Users can now configure MixpanelAPI behavior by including tags in the tag of their apps. The following meta-data keys are supported:

com.mixpanel.android.MPConfig.FlushInterval (value: a time in milliseconds)

If provided, the library will use this interval instead of the default as a target maximum duration between attempts to flush data to Mixpanel's servers.

com.mixpanel.android.MPConfig.DisableFallback (value: a boolean)

If provided and equal to "false", the library will attempt to send data over HTTP if HTTPS fails.

com.mixpanel.android.MPConfig.AutoCheckForSurveys (value: a boolean)

If provided and equal to "false", the Mixpanel library will not attempt to retrieve and show surveys automatically, users can still show surveys using MixpanelAPI.getPeople().checkForSurvey and MixpanelAPI.getPeople().showSurvey

Maven-Central artifact for Maven, Gradle, and AndroidStudio users

An aar artifact is now available in the Maven Central repository. You can add Mixpanel to your project by adding the following to your gradle.build file

dependencies {
    compile "com.mixpanel.android:mixpanel-android:4.0.0@aar"
}

Changes to the steps required to integrate the Mixpanel library in your project.

In previous releases, the Mixpanel library was distributed as a jar file. As of 4.0.0, use of the library varies with the build tools chosen.

For Eclipse and Ant

For building with Eclipse or ant, download the Mixpanel repository and follow the steps outlined here, for "Referencing a Library Project":

http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject

For Gradle and Android Studio

For building with Gradle or Android Studio- add the following dependency to your build.gradle file

      dependencies {
          compile "com.mixpanel.android:mixpanel-android:4.0.0@aar"
      }

A version of each release is hosted in Maven central, and will not require you to manually download or install any artifacts.

Fallback to HTTP from HTTPS is disabled by default

In previous releases, the Mixpanel library would automatically fall back to communicating over HTTP if HTTPS communication failed. This was to facilitate use on Android 2.2 (Froyo) and older OS versions, which had poor support for modern SSL certificates.

In the 4.0.0, HTTP fallback behavior is disabled by default, but can be reenabled for users who intend to ship to older devices by adding the following tags to the tag in your application's AndroidManifest.xml:

 <meta-data android:name="com.mixpanel.android.MPConfig.DisableFallback"
           android:value="false" />

Improved startup time

Previous releases performed some synchronous disk IO immediately when instances were created. This was typically very quick, but in 4.0.0 this IO is done in a separate thread and loaded lazily by the library.

API Behavior changes

Passing a null token or null context to MixpanelAPI.getInstance() will now result in a null return value.

The automatic $bluetooth_enabled property will only appear in recent OS versions

The automatic $bluetooth_enabled property will only be added automatically on devices with OS version greater than API 18/OS version 4.3/Jelly Bean MR2. This feature had a critical bug on older platforms, and was not in popular use.

Super properties named "distinct_id" will be ignored

Previous versions of the library allowed setting "distinct_id" as a super property, and would use this value as the distinct id for event tracking. This behavior has been removed, and super properties with the name "distinct_id" will be ignored. Callers can still provide their own value for "distinct_id" in the properties argument to track.

A scary stack trace log in the common, not-scary case of fallback from HTTPS to HTTP has been removed.

MixpanelAPI.setFlushInterval() has been deprecated.

Use the meta-data tag:

 <meta-data android:name="com.mixpanel.android.MPConfig.FlushInterval"
   android:value="XXX" />

instead, where "XXX" is the desired interval in Milliseconds.

MixpanelAPI.enableFallbackServer() has been deprecated.

Use the meta-data tag:

<meta-data android:name="com.mixpanel.android.MPConfig.DisableFallback"
  android:value="false" />

to enable fallback to HTTP if HTTPS is unavailable or the library is running on an Android 2.2 or older device.

Default build system for library is now Gradle

ant is no longer the primary build system for development. Although we intend to continue to support ant builds of the library, we will be using gradle to build and package the library going forward.