Code Monkey home page Code Monkey logo

customerio-android's Introduction

Power automated communication that people like to receive.

min Android SDK version is 21 Maven Central

Customer.io Android SDK

This is the official Customer.io SDK for Android.

Getting started

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: Check out our sample android app, Remote Habits, for a example of how to use our SDK.

Install the SDK

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()
    }
}

Available SDKs

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
tracking 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:tracking:<version-here>'
implementation 'io.customer.android:messaging-push-fcm:<version-here>'

Replace version-here with the the latest version: Maven Central

Initialize the SDK

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 = CustomerIO.Builder(
            siteId = "your-site-id",
            apiKey = "your-api-key",
            appContext = this
        ).build()


   }
}

The Builder for CustomerIO exposes configuration options for features such region,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()

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.

More information

See our complete SDK documentation at https://customer.io/docs/sdk/android/

Contributing

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.

License

MIT

customerio-android's People

Contributors

shahroz16 avatar levibostian avatar semantic-release-bot avatar ami-ci avatar joepurdy avatar russellcio avatar glosier avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.