Support SDK v2 in a nutshell

This page gives you the basic steps for getting up and running with Support SDK 2.2.

What you need

  • Your organization has a Zendesk Support account. You can register to start a free trial.

  • A Zendesk admin has registered your Android app in Zendesk Support. See Registering the application in Zendesk Support in the Support Help Center

  • The Zendesk admin has provided you with the initialization code for the app. The code was generated in Zendesk Support when the admin registered the app.

  • The features you want to use are included in your Zendesk Support plan. See the breakdown of features and limitations per plan.

Getting up and running

  1. Add the SDK to your project by including the following snippets in the build.gradle file:

    // Note: This is the root-level repositories container, not the one under 'buildScript'
    
    repositories {
        maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
    }
    ...
    dependencies {
        implementation group: 'com.zendesk', name: 'support', version: '2.2.1'
    }
    

    For details, see Adding the Support SDK.

  2. Initialize Zendesk in the onCreate() method of an Activity where you plan to use the SDK, or an Application subclass. Use the initialization details provided by the Zendesk Support admin and a Context (in bold):

    @Override
    public void onCreate() {
        super.onCreate();
    
        Zendesk.INSTANCE.init(this, "zendeskUrl", "appId", "clientId");
    
        Identity identity = new AnonymousIdentity();
        Zendesk.INSTANCE.setIdentity(identity);
    
        Support.INSTANCE.init(Zendesk.INSTANCE);
    }

    Note: If you're using multiple brands you can use a brand subdomain rather than the primary subdomain in the zendeskUrl in the code above.

  3. Create an identity (in bold) so the app can authenticate as a Zendesk Support user, and set this on the Zendesk singleton:

    @Override
     public void onCreate() {
         super.onCreate();

     Zendesk.INSTANCE.init(this, "zendeskUrl", "appId", "clientId");
    
     Identity identity = new AnonymousIdentity();
     Zendesk.INSTANCE.setIdentity(identity);
    
     Support.INSTANCE.init(Zendesk.INSTANCE);
    

    }

    There are two types of identity: anonymous and JWT. For details, see Setting an identity.

  4. Initialize the Support SDK using the Zendesk singleton you just initialized:

    @Override
    public void onCreate() {
        super.onCreate();
    
        Zendesk.INSTANCE.init(this, "zendeskUrl", "appId", "clientId");
    
        Identity identity = new AnonymousIdentity();
        Zendesk.INSTANCE.setIdentity(identity);
    
        Support.INSTANCE.init(Zendesk.INSTANCE);
    }

The Support SDK is now initialized and ready to be used.

Launching the Support SDK UI

The Support SDK provides four Activity classes:

  • HelpCenterActivity,
  • ViewArticleActivity
  • RequestActivity
  • RequestListActivity.

Each of these has a static builder method you can use to start the activity. Example:

    RequestActivity.builder()
        .show(context);

You can use the builder object to configure the activity before starting it. Example:

    RequestActivity.builder()
       .withRequestSubject("Testing Support SDK 2.0")
       .withTags("2.0", "testing")
       .show(context);

The builder can also return an Intent for the configured activity, to be started later. This is handy for PendingIntents and other asynchronous events. Example:

    Intent requestActivityIntent = RequestActivity.builder()
       .withRequestSubject("Testing Support SDK 2.0")
       .withTags("2.0", "testing")
       .intent(context);

You can even pass one activity's UiConfig to another activity, to be applied if one of them starts the other. For details, see Configuring the SDK activities.

To learn more, see Adding Help Center, Adding Tickets, and the Activity builder reference.

For comprehensive reference documentation, see the Support SDK Javadocs on Github.

To see some samples of different ways to use the Zendesk mobile SDKs, have a look at our sample apps repo on Github.