This is the official Customer.io SDK for Android.
The SDK supports both Kotlin and Java.
To get started, you need to install and initialize the relevant SDK packages in your project. We've separated our SDK into packages to minimize our impact on your app's size. You should only install the packages that you need for your project.
Tip: For example integrations and usage, check out our sample apps.
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, in your root level build.gradle
file, make sure that you have mavenCentral()
added as a repository:
allprojects {
repositories {
google()
mavenCentral()
}
}
We separated our SDK into packages to minimize our impact on your app's size. You should only install the packages that you need for your project.
Package | Required? | Description |
---|---|---|
datapipelines |
Yes | identify people/devices and send events (to trigger campaigns, track metrics, etc). |
messaging-push-fcm |
No | Push and rich push notifications using Google Firebase Cloud Messaging (FCM). |
implementation 'io.customer.android:datapipelines:<version-here>'
implementation 'io.customer.android:messaging-push-fcm:<version-here>'
Replace version-here
with the the latest version:
Before you can use the Customer.io SDK, you need to initialize it. CustomerIO
is a singleton: once created it will be re-used, until you decide to reconfigure and recreate the instance.
class App : Application() {
override fun onCreate() {
super.onCreate()
val customerIO = CustomerIOBuilder(
applicationContext = this,
cdpApiKey = "your-cdp-api-key"
).build()
}
}
The Builder
for CustomerIO exposes configuration options for features such region
,timeout
.
val builder = CustomerIOBuilder(
applicationContext = this,
cdpApiKey = "your-cdp-api-key"
)
builder.setRegion(Region.EU)
// set the number of events that should be queued before they are flushed to the server.
builder.setFlushAt(10)
builder.build()
A best practice is to initialize CustomerIO in the Application class, this way you will be able to access that instance from any part of your application using the instance() method.
See our complete SDK documentation at https://customer.io/docs/sdk/android/
Thanks for taking an interest in our project! We welcome your contributions. Check out our development instructions to get your environment set up and start contributing.
Note: We value an open, welcoming, diverse, inclusive, and healthy community for this project. We expect all contributors to follow our code of conduct.