Support Home > SDK Integration > Android – SDK Integration

Android – SDK Integration


The Kochava Android SDK is a lightweight plugin which can be easily integrated into your Android project. The entire integration process takes less than five minutes and simply requires adding the SDK within your project and then starting the Kochava Tracker in code. If you have already integrated the SDK and started the tracker, please visit Using the SDK and choose a topic.


Integrating the SDK

Requirements:

  • Android API 14
  • Internet Permission
  • Google Play Services Ads Identifier Library (If publishing to Google Play)
  • Google Install Referrer Library (If publishing to Google Play)

 

Supported Platforms:

  • Android
  • Android TV
  • Android Wear
  • Android Auto
  • Android Instant App
  • Google Daydream VR
  • Samsung Gear VR
  • Amazon Fire

Integration:

Estimated Time to Complete
5 Minutes
  1. Add the SDK.
  2. In order to use the Kochava SDK, first add it within your project. This can be accomplished using Gradle (recommended) or by downloading the SDK AAR files manually and adding them.

    • Add the Kochava maven repository to your project level build.gradle file.

       

      Add the Kochava SDK to your module level build.gradle file. If you have a multiple module project this should be added to your base module. Replace “x.y.z” with the latest version obtained from the Download Badge above.

    • Download the tracker and tracker-network AAR files from the Download Badge above and either add them directly or extract the JAR files and other resources from them and add them individually.

     

    Collection of networking related data points can be enabled/disabled from the Kochava Dashboard. However if you wish to completely remove the ability of the SDK to collect them you can remove the optional tracker-network artifact from the dependencies list. To do this you must tell Gradle not to pull in transitive dependencies from the main tracker dependency.

     

  3. Add Dependencies.
  4. Dependencies are added alongside the Kochava SDK in your module level build.gradle file.

     

  5. Add Permissions.
  6. Permissions are added to the top level of the AndroidManifest.xml file. If an automatically included permission is unwanted it can be removed using the tools:node=”remove” feature.

    NOTE: Ensure you are compliant with the terms and requirements of the publishing app store regarding sensitive permissions such as GET_ACCOUNTS.

     

  7. Install Referrer Broadcast Receiver.
  8. In addition to using the installreferrer dependency for retrieving the Google Play Install Referrer the Kochava SDK can obtain the legacy Install Referrer using a broadcast receiver. This broadcast receiver is automatically included through the AAR and for most implementations there is nothing more to do. Only if your app has multiple broadcast receivers that listen for the “com.android.vending.INSTALL_REFERRER” action are some additional steps required.

    Remove the Kochava ReferralReceiver from the manifest merge by entering the following within the application tags in your manifest.

     

    Create your own exported broadcast receiver using the “com.android.vending.INSTALL_REFERRER” intent filter action. This should be the only broadcast receiver in your manifest which will then forward the intent to all other broadcast receivers in it’s onReceive method.


Starting the Tracker

Estimated Time to Complete
1 Minute

Once you have added the Kochava SDK to your project, the next step is to configure and start the Kochava Tracker in code. Only your App GUID is required to start the tracker with the default settings, which is the case for typical integrations.

We recommend starting the tracker within the Application.onCreate method, although this can be done elsewhere if needed. Starting the tracker as early as possible will provide more accurate session reporting and help to ensure the tracker has been started before using it. Keep in mind the tracker can only be configured and started once per launch.

In a multi-process app the tracker can only be run out of a single process. Before starting the tracker check the current process and ensure it is only started in the primary app process.

 

Developer API Reference:

Tracker.configure(Configuration)
Tracker.Configuration

 

SDK WAYPOINT: At this point basic integration is complete and the Kochava SDK will begin reporting session activity and attributing installs.

 

Where to Go From Here:

Now that you have completed integration you are ready to utilize the many features offered by the Kochava SDK. Continue on to Using the SDK and choose a topic.


Custom Tracker Configuration

If you would like to make adjustments to the tracker configuration beyond the default settings, set your App GUID and the desired parameters and then pass it to the tracker’s configure method.

 

Using a Custom Configuration:

NOTE: Setting values within a configuration object will have no effect after the tracker has been started.


Below is a list of all configuration options and their default settings. Keep in mind that in a typical integration these configuration settings should not be adjusted from their default values.

Default — None

This string should be set to your Kochava App GUID, which can be found in your Edit App page within the Kochava dashboard. This value is always required (unless a Partner Name is set).

Default — None

Provide an attribution event listener if you wish to be notified of attribution results from Kochava servers. This is not necessary unless you wish to parse the attribution results for use within the app.

For complete details and examples, see: Retrieving Attribution.

Default — LOG_LEVEL_INFO

Set this value to the desired Log Level to be used by the SDK for debugging purposes.

For complete details and examples, see: Enabling Logging.

Default — false

If you wish to limit ad tracking at the application level, with respect to Kochava conversions, set this value to true. It can also be toggled after starting the tracker.

For complete details and examples, see: App Limit Ad Tracking.

Default — (none)

This is a reserved setting and should not be set unless provided by your Client Success Manager.

Default — (none)

This is a reserved value and should not be set unless provided by your Client Success Manager.

Default — (false)
As GDPR compliance can present many challenges during development, Kochava offers a fully managed solution for all your GDPR consent requirements through the use of our Intelligent Consent Management feature. By using this feature the Kochava SDK will handle determining when consent is required for any user while shouldering much the GDPR burden for you.

NOTE: This is an advanced feature requiring additional setup within your Kochava dashboard and should not be enabled without a full and complete understanding of how to use the Intelligent Consent Management feature.

For complete details and examples, see: Intelligent Consent Management.


Migration Guide

If you are migrating from a Kochava SDK version prior to version 3.0.0 then follow the migration steps outlined in the migration guide before proceeding with integrating the current SDK.

 
 

Last Modified: Nov 29, 2018 at 3:32 pm