The Support SDK for Android lets you embed customer-service features right in your mobile applications. In this series of tutorials, we'll look at implementing the basic aspects of the SDK using Java.
This tutorial covers the first steps of using the SDK:
- Configuring the SDK in Zendesk Support
- Enabling SDK logging
- Initializing the SDK
- Setting an identity
The other tutorials in the series cover how to add components to your mobile app:
This tutorial series assumes the following:
- You're comfortable with Android development and with using either Gradle or Maven for your dependencies
- You're using Android API level 9 (2.3) or higher
- You're using the SDK framework v188.8.131.52 or higher
Configuring the SDK in Zendesk Support
Before doing any coding, you need to set up and save your app in Zendesk Support. Go to Settings > Channels > Mobile SDK in your Zendesk and configure the setup you'd like for your iOS app. For details on customizing the Mobile SDK admin settings, see Using the Mobile SDK to embed customer service in your app .
An administrator in your Zendesk can define the settings and capabilities you want for your SDK implementation. They can be changed at any time.
As a developer, you'll need the code snippet labeled Android code snippetSetup
Copy the snippet from the text box. Once you have it, you can start implementing the SDK in your app.
Enabling SDK logging
The Support SDK comes with a built-in logger. With logging enabled, your console displays error messages with important details about your SDK implementation. It can help in the troubleshooting process if you run into problems. We highly recommend enabling it during the development process.
// Enable SDK Logging
Initializing the SDK
After setting up the SDK configuration in Zendesk Support, you can use the Java code snippet you copied to initialize the SDK in your app.
: To reduce total network usage, we recommend placing the snippet in the
method of the activity that starts your Help section. Don't place it in the
method of your Application class or of your main activity.
The Java code you retrieved should look something like this:
// Initialization code ZendeskConfig.INSTANCE.init(
this, "zendeskUrl", "application_id", "oauthClientId");
Setting an identity
After initializing the SDK, make absolutely certain that you set an identity for your user (even if it's blank). The code for setting your identity depends on your authentication method and the information you have -- or don't have yet.
The identity is based on what type of authentication you chose in your SDK settings. It's either Anonymous or JSON Web Token (JWT) authentication. See Authentication in the SDK developer docs for more information.
Setting an identity consists of two steps. First, define an identity variable based on the type of authentication you're using. Second, use the variable to set the user identity. Examples:
// Anonymous Auth
Identity identity = new AnonymousIdentity.Builder().build();
// JWT Auth
Identity identity = new JwtIdentity("jwt_user_identifier");
Great! You initialized the SDK and set your user's identity. You've taken the first step toward implementing support functionality in your Android app.
The next tutorials in the series show you how to add features to your app, including giving users access to your Help Center content, letting them rate your app, and letting them create and view support requests. Click to go to the next tutorial now: Part 2 - Adding Help Center .