Android Tracker Setup 0.2.0 - chuwy/snowplow-ci GitHub Wiki

HOME > SNOWPLOW SETUP GUIDE > Step 2: setup a Tracker > Android tracker

Contents

## 1. Overview

The Snowplow Android Tracker lets you add analytics to your Android-based mobile apps and games.

The Tracker should be relatively straightforward to setup if you are familiar with Java/Android development.

Ready? Let's get started.

Back to top

## 2. Integration options ### 2.1 Tracker compatibility

The Snowplow Android Tracker has been built and tested using the Android SDK version 21, but uses a minimum SDK version of 11, so should work within any Android application built using SDK version 11 upwards.

Back to top

### 2.2 Dependencies

To minimize jar bloat, we have tried to keep external dependencies to a minimum. For the full list of dependencies, please see our [Gradle build file] gradle-build.

Back to top

## 3. Setup ### 3.1 Hosting

The Tracker is published to Snowplow's [hosted Maven repository] maven-snplow, which should make it easy to add it as a dependency into your own Android app.

The current version of the Snowplow Android Tracker is 0.2.0.

### 3.2 Maven

If you are using Maven for building your Android application, then add the following code into your HOME/.m2/settings.xml to be able to use this repository:

<settings>
  <profiles>
    <profile>
      <!-- ... -->
      <repositories>
        <repository>
          <id>com.snowplowanalytics</id>
          <name>SnowPlow Analytics</name>
          <url>http://maven.snplow.com/releases</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
</settings>

Then add into your project's pom.xml:

<dependency>
    <groupId>com.snowplowanalytics</groupId>
    <artifactId>snowplow-android-tracker</artifactId>
    <version>0.2.0</version>
</dependency>
<dependency>
    <groupId>com.snowplowanalytics</groupId>
    <artifactId>snowplow-java-tracker-core</artifactId>
    <version>0.2.0</version>
</dependency>
### 3.3 Gradle

If you are using Gradle in your own Android application, then add our Maven repository in your build.gradle file:

repositories {
    ...
    maven {
        url "http://maven.snplow.com/releases"
    }
}

Then add into the same file:

dependencies {
    ...
    // Snowplow Android Tracker
    compile 'com.snowplowanalytics:snowplow-android-tracker:0.2.*'
    compile 'com.snowplowanalytics:snowplow-java-tracker-core:0.2.*'
}
#### 3.3.1 Android Archive

You can also add the Android Tracker using the Android ARchive (aar) package in your gradle file in a similar way to the Gradle version while appending '@aar' to the end:

dependencies {
    ...
    // Snowplow Android Tracker
    compile 'com.snowplowanalytics:snowplow-android-tracker:0.2.*@aar'
}
### 3.4 Permissions

To send the events, you need to update your AndroidManifest.xml with the internet access permission:

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

If you want to send location information with each event you will need to add the following permissons to your AndroidManifest.xml:

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Done? Now read the Java/Android Tracker API to start tracking events.

⚠️ **GitHub.com Fallback** ⚠️