Skip to content

Kit Development

Sam Dozor edited this page Jun 10, 2016 · 4 revisions

How to create a Kit

This guide is meant for integration partners who would like add their own SDK or functionality to the mParticle platform. mParticle integrates with over 80 partners in the mobile app ecosystem, and each integration is unique. Whereas most integration are via our Firehose API, or developed internally for the server-side, the mParticle mobile SDKs are designed to be extensible in the form of "kits" for client-side integrations.

Kit Overview

The mParticle Core iOS and Android SDKs are responsible for detecting, initializing, and forwarding data to the kit framework. By default, the Core SDK dependency does not include any kits - each desired kit must be specified as an additional dependency. The kit framework allows you to hook into and listen for mParticle's public APIs as well as crucial application lifecycle events. It's the responsibility of the kit implementation to then map those APIs onto the respective partner APIs. Kits will often include a 3rd-party SDK, or they might just contain a bit of additional functionality.

Configuration

At runtime, the Core SDKs will receive configuration from the mParticle server, instructing it of which kits it should initialize. In a typical scenario whereby a kit wraps/embeds a 3rd-party SDK, the configuration will include a map of settings, including the API key/credentials that the given SDK needs in order to be initialized. Customers use the mParticle platform UI to enable kits and input their credentials.

Getting Started

mParticle provides a sample repository that you can fork and make your own, and then submit for review. To get started, fork, clone, or download the code. If you'd like to iterate in private, you can push your code to a private repository and work with the mParticle partnerships and engineering team to get your code reviewed.

Get the example here

Once you've forked/downloaded the example repository, you'll want to edit the following files to be specific to your implementation:

  • ./build.gradle to add any necessary dependencies, such as your company's SDK.
  • src/main/java/com/mparticle/kits/ExampleKit.java - this is where your primary implementation belongs.
    • Choose the additional interfaces that you need and have this class implement them. See below.
  • ./README.md
  • ./src/main/AndroidManifest.xml
  • ./consumer-proguard.pro

Kit Interfaces

The core of your implementation will live in ExampleKit.java (renamed for your company). This file must be a subclass of the KitIntegration class, made available by the mParticle kit framework. This class provides additional interfaces that you must implement depending on the type of data that your kit can process:

KitIntegration.ActivityListener

Kits should implement this interface when they require Activity callbacks for any reason.

KitIntegration.AttributeListener

Kits should implement this interface when their underlying service has the notion of a user with attributes.

KitIntegration.CommerceListener

Kits should implement this interface in order to listen for eCommerce events.

KitIntegration.EventListener

Kits should implement this listener to ensure they receive events as they are sent into the mParticle SDK.

KitIntegration.PushListener

Kits should implement this interface when they have Google Cloud Messaging/push features.

See the javadocs for more information on the KitIntegration class and its interfaces.

Submitting your Kit

  1. Create a public fork
  2. Once you've completed development, submit a pull request to merge into the example.
  3. When ready, an mParticle engineer will create a new repository for your kit and push the code there.
Clone this wiki locally