Get Started

Before you can take advantage of our SDK, you need to install the module(s) you want to use, initialize the SDK, and understand the order of operations.

This page is part of an introductory series to help you get started with the essential features of our SDK. The highlighted step(s) below are covered on this page. Before you continue, make sure you've implemented previous features—i.e. you can't identify people before you initialize the SDK!

graph LR getting-started(Install SDK) -->B(Initialize SDK) B --> identify(identify people) identify -.-> track-events(Send events) identify -.-> push(Receive push) identify -.-> rich-push(Receive Rich Push) track-events --> testing-error-handling(handle errors) push --> testing-error-handling rich-push --> testing-error-handling click getting-started href "/docs/sdk/android/getting-started" click B href "/docs/sdk/android/getting-started/#initialize-the-sdk" click identify href "/docs/sdk/android/identify" click track-events href "/docs/sdk/android/track-events/" click push href "/docs/sdk/android/push" click rich-push href "/docs/sdk/android/rich-push" click testing-error-handling href "/docs/sdk/android/testing-error-handling" style getting-started fill:#B5FFEF,stroke:#007069 style B fill:#B5FFEF,stroke:#007069

Before you begin

If you want to try out our new SDKs, contact product@customer.io!

Before you begin, you should understand that our SDK is in alpha and is subject to change. We're excited about it—and we hope you are too—but it is still a work in progress.

SDK packages

To minimize our impact on your app’s size, we offer multiple, separate SDKs. You should only install the SDKs that you need for your project.

You must install the Tracking SDK. It lets you identify people, which you must do before you can send them messages, track their events, etc.

Package Required? Description
tracking identify people in Customer.io
messaging-push-fcm Receive and interpret push notifications

How it works

Our SDKs provide a ready-made integration to identify people who use mobile devices and send them notifications. Before you start using the SDK, you should understand a bit about how the SDK works with customer.io.

sequenceDiagram participant A as Mobile User participant B as SDK participant C as Customer.io A--xB: User activity
user not identified A->>B: Logs in (identify method) rect rgb(229, 254, 249) Note over A,C: Now you can Send events and receive messages B-->>C: Person added/updated in CIO A->>B: User activity (track event) B->>C: Event triggers campaign C->>B: Campaign triggered push B->>A: Display push A->>B: Logs out (stopIdentify method) end A--xB: No longer sending events or receiving messages

You must identify a person before you can take advantage of most SDK features. We don’t currently support messages or events for anonymous devices/users, which means that we can’t track or respond to anything your audience does in your app until you identify them.

In Customer.io, you identify people by id or email, which typically means that you need someone to log in to your app or service before you can identify them.

While someone is “identified”, you can send events representing their activity in your app to Customer.io. You can also send the identified person messages from Customer.io.

You send messages to a person through the Customer.io campaign builder, broadcasts, etc. These messages are not stored on the device side. If you want send an event-triggered campaign to a mobile device, the mobile device user must be identified and have a connection such that it can send an event back to Customer.io and receive a message payload.

Install the SDK

You’ll find detailed instructions to install our SDK in our Github repository.

  1. Before you add Customer.io dependencies, update your repositories in the settings.gradle file to include mavenCentral():

    dependencyResolutionManagement {
       repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
       repositories {
          google()
          mavenCentral()
       }
    }
       

    Or, if you’re using an earlier project setup, make sure that you have added mavenCentral() as a repository in your root-level build.gradle file:

    allprojects {
       repositories {
          google()        
          mavenCentral()
       }
    }
       
  2. Install the dependencies that are relevant to your implementation. Replace version-here with the the latest version (available in our github repository).

    implementation 'io.customer.android:tracking:<version-here>'
    implementation 'io.customer.android:messaging-push-fcm:<version-here>'
       

Initialize the SDK

Before you can use the Customer.io SDK, you need to initialize it. CustomerIO is a singleton: you’ll create it once and re-use it across your application.

You should in CustomerIO in the Application class, so that you can access that instance from any part of your application using the instance() method.

class App : Application() {
   override fun onCreate() {
      super.onCreate()
      val customerIO = CustomerIO.Builder(
         siteId = "your-site-id",
         apiKey = "your-api-key",
         appContext = this
      ).build()
   }
}

The Builder for CustomerIO exposes configuration options for features like region, and timeout.

val builder = CustomerIO.Builder(
   siteId = "YOUR-SITE-ID",
   apiKey = "YOUR-API-KEY",
   appContext = this
)
builder.setRegion(Region.EU)
// set the request timeout for all the API requests sent from SDK
builder.setRequestTimeout(8000L)
builder.build()
Copied to clipboard!