Build a UI SDK App for Android

The UI SDK allows you to add Messaging for In-App into your iOS app with a ready-to-go user experience. Open a conversation with the UIClient class. You can customize the colors and strings so that the Messaging user interface looks natural in your app.

This article applies to the following implementations:

UI SDKCore SDK

Most of the SDK classes are from these two packages:

Create a UIConfiguration object using the config file that you previously downloaded from your org, or you can manually add the values from within this config file.

This example creates a random UUID for the conversation ID. However, if you want this conversation to persist even after the app is restarted, be sure to use the same conversation ID. Also, if you want to see this same conversation across multiple devices, in addition to using the same conversation ID, turn on user verification, which is described in the Enhance the Experience section.

OPTION 1: Configure Using the Config File

Once you've added the config.json file to your project, you can reference it from the code.

To learn how to download the config file from your org, see Configure a Messaging for In-App Deployment in Salesforce Help. This file contains the Service API URL, the org ID, and the API name for the deployment. For example:

{
  "OrganizationId": "00ZZZ0000000Zzz",
  "DeveloperName": "MyMessagingForInAppDeployment",
  "Url": "https://zzzz.my.api.url.salesforce-scrt.com"
}

OPTION 2: Configure Manually with Config Info

If you don't want to use the config.json file in your project, you can configure the SDK manually using the Service API URL, the org ID, and the API name for the deployment.

Create a UIClient object. Open a conversation to show the UI.

Without any additional code, the UI SDK automatically provides your customers with Messaging features such as pre-chat forms, bot support, file attachments, and estimated wait time. To learn how to configure these features in your org, visit our Messaging for In-App and Web learning map.

This step is optional.

The UI SDK automatically brands the app with a default color scheme, provides icons for all UI elements, and uses default text for all UI labels. However, you can customize these elements with the UI SDK.

  • To customize the color scheme in your app, create a color resource file in your app using the SDK's token names. To learn more, see Customize Colors for Android.
  • To customize any UI text, create a strings.xml resource file in your app using the SDK's resource names. To learn more, see Customize Strings for Android.
  • To customize the icons and images used throughout the SDK, add a drawable asset to your project using the associated keyword. To learn more, see Customize Icons for Android.

This step is optional.

You can enhance your users' experience by adding push notifications, passing information to Salesforce about a verified user, sending hidden pre-chat fields, and providing parameters for an auto-response component, such as a link to a survey.