Getting started
This getting started guide shows you how to integrate Zendesk Messaging into your Android app.
Prerequisites
- Zendesk Support or Suite plan
- minSdkVersion 21
- Java 8 (add to your
build.gradle
):android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
1. Add the SDK dependency
Update settings.gradle.kts
to include the Zendesk Maven repository:
Kotlin:
repositories {
maven {
url = uri("https://zendesk.jfrog.io/artifactory/repo")
}
}
Groovy:
repositories {
maven {
url = uri("https://zendesk.jfrog.io/artifactory/repo")
}
}
Update build.gradle.kts
to add the Zendesk Messaging SDK dependency:
Kotlin:
dependencies {
implementation("zendesk.messaging:messaging-android:latest_version")
}
Groovy:
dependencies {
implementation "zendesk.messaging:messaging-android:latest_version"
}
Replace latest_version
with the version from the Release Notes.
The following permissions are automatically added to your Android manifest.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
2. Get your channel key
How to get a channel key from Zendesk Admin Center.
3. Initialize the SDK
Add the initialization code to your Application
class as shown below:
Kotlin
Zendesk.initialize(
context = this,
channelKey = "<your_channel_key>",
successCallback = { zendesk ->
// Handle success case
},
failureCallback = { error ->
// Handle failure case
},
messagingFactory = DefaultMessagingFactory()
)
Java
Zendesk.INSTANCE.initialize(
this,
"<your_channel_key>",
zendesk -> // Handle success case,
error -> // Handle failure case
new DefaultMessagingFactory()
);
4. Show Messaging
You can display the messaging interface anywhere in your app using the following code:
Kotlin
Zendesk.instance.messaging.showMessaging(context)
Java
Zendesk.getInstance().getMessaging().showMessaging(context);
SDK size
The size of the Zendesk SDK for Android after installation will vary depending on your integration and build settings. As a general guideline:
- AAR download size: Approximately 7.5 MB (may vary by version)
- App size impact: The final impact on your app’s size may be smaller after Proguard/R8 minification and resource shrinking.
- Dependency impact: Additional dependencies (such as Play Services or Firebase for push notifications) may increase the total size.
Migrating from Classic or Sunshine Conversations SDK?
If you are migrating from the Classic SDK or Sunshine Conversations SDK, please refer to the dedicated migration guides for best practices, side-by-side integration, and troubleshooting: