Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.driftt:drift-sdk-android:v1.2.10'
}
dependencies {
implementation("com.github.driftt:drift-sdk-android:v1.2.10")
}
<dependency>
<groupId>com.github.driftt</groupId>
<artifactId>drift-sdk-android</artifactId>
<version>v1.2.10</version>
</dependency>
libraryDependencies += "com.github.driftt" % "drift-sdk-android" % "v1.2.10"
:dependencies [[com.github.driftt/drift-sdk-android "v1.2.10"]]
Drift is the official Drift SDK for Android
Drift uses Jitpack for its releases
Add Jitpack to your root build.gradle file
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
You can then add drift as a dependency in your app build.gradle file
dependencies {
compile 'com.github.driftt:drift-sdk-android:v1.2.10'
}
To get started with the Drift SDK you need the embed ID from your Drift settings page. This can be accessed here by looking after the drift.load method in the Javascript SDK.
For devices running API level 19 you will need to call ProviderInstaller.installIfNeeded(this);
in your initial activity before registering with Drift due to a change in certificates.
In your Application onCreate
method call:
Drift.setupDrift(this, "");
Once your user has successfully logged into the app registering a user with the device is done by calling register user with a unique identifier, typically the id from your database, and their email address:
Drift.registerUser("123748", "sample@drift.com");
When your user logs out simply call logout so they stop receiving messages.
Drift.logout();
A user can begin a conversation in response to a campaign or by presenting the conversations list:
Drift.showConversationActivity();
You can also go directly to create a new conversation using:
Drift.showCreateConversationActivity();
That's it. You're good to go!!
Configuring the colors used within the app can be done here
To configure the accent color used in the SDK you should define a color attribute in your apps color resource file.
<color name="driftColorAccent">#157AFB</color>
Contributions are very welcome 🤘.