# legacydeveloper Service Sdk Android - Full Documentation # Accessibility with the for Android for Android The Service Chat SDK is accessible to customers that use a screen reader. Depending on your needs, you can also change some settings to expand accessibility. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). ## Disable the Minimized View in Chat By default, a chat session starts out as a minimized, thumbnail view that you tap to open. This minimized view is not optimal for accessibility because a visually impaired person could have trouble locating the thumbnail. To improve accessibility, we suggest starting the session in the full-screen view. When building the [ChatUIConfiguration](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/ui/ChatUIConfiguration.html) object, set defaultToMinimized to false. ChatUIConfiguration uiConfig = new ChatUIConfiguration.Builder() .chatConfiguration(chatConfiguration) .defaultToMinimized(false) .build(); See [Quick Setup: Chat in the](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_chat_basic_setup.htm "To add Chat to your Android app, create a configuration object that points to your org and then create a Chat UI client."). ## Contrast Ratio Considerations By default, we brand the SDK using a 4.2 contrast ratio. You can customize the colors to increase this contrast ratio. See [Customize Colors with the](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_customize_colors.htm "You can customize the look and feel of the interface by specifying the colors used throughout the UI."). ## Known Issues - Chat: A screen reader doesn’t read the event text when an agent invites another agent to the chat session. # Additional Resources If you’re looking for other resources, check out this list of links to related documentation. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). - Embedded Service Chat SDK for Mobile Apps Resources - [Service Chat SDK Developer Center](https://developer.salesforce.com/developer-centers/service-cloud/sdk/) - Service Chat SDK [Trailhead Learning Module](https://trailhead.salesforce.com/modules/service_snap-ins_mobile_apps) - iOS: [Release Notes](https://github.com/forcedotcom/ServiceSDK-iOS/releases), [Dev Guide](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/servicesdk_ios_dev_guide.htm), [Reference Docs](https://forcedotcom.github.io/ServiceSDK-iOS/), [Examples](https://github.com/forcedotcom/ServiceSDK-iOS/tree/master/Examples) - Android: [Release Notes](https://github.com/forcedotcom/ServiceSDK-Android/releases), [Dev Guide](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/servicesdk_android_dev_guide.htm), [Reference Docs](https://forcedotcom.github.io/ServiceSDK-Android/), [Examples](https://github.com/forcedotcom/ServiceSDK-Android/tree/master/Examples) - General Resources - [Service Cloud Developer Center](https://developer.salesforce.com/developer-centers/service-cloud/) - [Salesforce Developer Documentation](https://developer.salesforce.com/docs/) - [Salesforce Help](https://help.salesforce.com/apex/Help_Home) # Analytics with the for Android for Android You can listen to user-driven events from the Service Chat SDK using the ServiceAnalytics system. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). Implement [ServiceAnalyticsListener](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/analytics/ServiceAnalyticsListener.html) and add your listener to [ServiceAnalytics](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/analytics/ServiceAnalytics.html) to start receiving events. In Java: ServiceAnalytics.addListener(new ServiceAnalyticsListener() { @Override public void onServiceAnalyticsEvent(String behaviorId, Map eventData) { // TO DO: Do something with analytics data } }); In Kotlin: ServiceAnalytics.addListener { behaviorId, eventData -> // TO DO: Do something with analytics data } When you receive an event, inspect the behaviorId to see the behavior that caused the event (for example, KNOWLEDGE\_UI\_USER\_LAUNCH). Inspect the eventData map for contextual data related to the event (for example, KnowledgeUIAnalytics.DATA\_CATEGORY\_GROUP\_NAME). For a list of behaviors and the key constants for parsing the eventData map, see the analytics class for the desired feature. Knowledge Analytics [KnowledgeUIAnalytics](https://forcedotcom.github.io/ServiceSDK-Android/releases/knowledge/4.3.6/api/reference/com/salesforce/android/knowledge/ui/KnowledgeUIAnalytics.html) Case Management Analytics [CasesUIAnalytics](https://forcedotcom.github.io/ServiceSDK-Android/releases/case/4.2.7/api/reference/com/salesforce/android/cases/ui/CasesUIAnalytics.html) Chat Analytics [ChatAnalytics](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatAnalytics.html) # Android Examples Use these examples to learn more about the Service Chat SDK. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). Check out our [sample apps on GitHub](https://github.com/forcedotcom/ServiceSDK-Android/tree/master/Examples) ([github.com/forcedotcom/ServiceSDK-Android](https://github.com/forcedotcom/ServiceSDK-Android/tree/master/Examples)). # Authenticating Using the Salesforce Mobile SDK These instructions describe how to authenticate the Service Chat SDK using the provided authentication mechanism within the Salesforce Mobile SDK. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). Before starting, make sure that you’ve already: - Installed the Service Chat SDK. See [Install the Service SDK for Android](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_install_sdk.htm#ess_sdk_setup_android "Install the Service SDK for Android using Gradle."). - Installed the [Salesforce Mobile SDK](https://github.com/forcedotcom/SalesforceMobileSDK-Android). If you want to install this SDK using maven, add a dependency on com.salesforce.mobilesdk:SalesforceSDK: to your module's build.gradle file. - Created a connected app that allows the SDK to authenticate with your Salesforce Experience Cloud site. See [Connected Apps](https://help.salesforce.com/articleView?id=connected_app_overview.htm&language=en_US). For an overview of Salesforce authentication from a mobile device, see [Understand Security and Authentication](https://trailhead.salesforce.com/en/modules/mobile_sdk_introduction/units/mobilesdk_intro_security). ![Note](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note.png) #### Note When creating a connected app, be sure that it has access to the chatter\_api scope. See [Scope Parameter Values](https://help.salesforce.com/articleView?id=remoteaccess_oauth_scopes.htm&language=en_US). 1. If you're using a Salesforce Experience Cloud site, be sure to configure the login endpoint as described in the Salesforce Mobile SDK documentation ([Configure the Login Endpoint](https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/communities_login_endpoint.htm)). The documentation describes how to use the first server listed in your servers.xml file as the default login location. For example: 2. Add an account\_type property to strings.xml. The property must be unique to your app to prevent conflicts with other apps that use the Service Chat SDK or the Salesforce Mobile SDK. com.mycompany.myapp 3. Implement [AuthenticatedUser](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/http/AuthenticatedUser.html) as a wrapper to your Mobile SDK user. In Java: import com.salesforce.androidsdk.accounts.UserAccount; import com.salesforce.android.service.common.http.AuthenticatedUser; public class MobileSdkUser implements AuthenticatedUser { private final String mUserId; public MobileSdkUser (UserAccount userAccount) { mUserId = userAccount.getUserId(); } @Override public String getUserId () { return mUserId; } } In Kotlin: class MobileSdkUser(userAccount: UserAccount) : AuthenticatedUser { private val mUserId: String init { mUserId = userAccount.getUserId() } override fun getUserId(): String { return mUserId } } ![Note](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note.png) #### Note AuthenticatedUser.getUserId must return the Salesforce user ID (UserAccount.getUserId) for the Case Management message feed to display correctly. 4. Implement [AuthTokenProvider](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/http/AuthTokenProvider.html) as a wrapper to your Mobile SDK authentication system. In Java: import android.support.annotation.NonNull; import android.support.annotation.Nullable; import com.salesforce.android.service.common.http.AuthTokenProvider; import com.salesforce.android.service.common.http.ResponseSummary; import com.salesforce.androidsdk.rest.ClientManager; public class MobileSdkAuthTokenProvider implements AuthTokenProvider { private final ClientManager.AccMgrAuthTokenProvider mTokenProvider; private String mAuthToken; public MobileSdkAuthTokenProvider (ClientManager.AccMgrAuthTokenProvider tokenProvider, String initialToken) { mTokenProvider = tokenProvider; mAuthToken = initialToken; } @Nullable @Override public String getToken () { return mAuthToken; } @Nullable @Override public String getTokenType () { return "Bearer"; } @Override public boolean canRefresh () { return true; } @Override public void refreshToken (@NonNull ResponseSummary responseSummary) { mAuthToken = mTokenProvider.getNewAuthToken(); } } In Kotlin: class MobileSdkAuthTokenProvider( private val mTokenProvider: ClientManager.AccMgrAuthTokenProvider, private var mAuthToken: String?) : AuthTokenProvider { override fun getToken(): String? { return mAuthToken } override fun getTokenType(): String? { return "Bearer" } override fun canRefresh(): Boolean { return true } override fun refreshToken(responseSummary: ResponseSummary) { mAuthToken = mTokenProvider.getNewAuthToken() } } 5. When your app launches, initialize the Salesforce Mobile SDK. // Initialize the Salesforce Mobile SDK SalesforceSDKManager.initNative(context, null, MainActivity.class); For more information, see the [SalesforceSDKManager documentation](https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/android_native_classes_salesforcesdkmanager.htm) in the Mobile SDK Developer’s Guide. 6. Write code that allows a user to log in and log out of their org using the Salesforce Mobile SDK. Make sure the user logs in before showing the Service Chat SDK UI. For example: public void login (final Activity activity) { SalesforceSDKManager.getInstance() .getClientManager() .getRestClient(activity, new ClientManager.RestClientCallback() { @Override public void authenticatedRestClient (RestClient client) { // Handle authenticated state activity here } }); } public void logout (final Activity activity) { SalesforceSDKManager.getInstance().logout(activity, true); } 7. When configuring Knowledge (using [KnowledgeConfiguration](https://forcedotcom.github.io/ServiceSDK-Android/releases/knowledge/4.3.6/api/reference/com/salesforce/android/knowledge/core/KnowledgeConfiguration.html)) or Case Management (using [CaseConfiguration](https://forcedotcom.github.io/ServiceSDK-Android/releases/case/4.2.7/api/reference/com/salesforce/android/cases/core/CaseConfiguration.html)), use the withAuthConfig method in the builder and pass in your implementation for [AuthenticatedUser](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/http/AuthenticatedUser.html) and [AuthTokenProvider](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/http/AuthTokenProvider.html). This code sample illustrates how it works with Knowledge: // Create Knowledge configuration builder KnowledgeConfiguration.Builder builder = KnowledgeConfiguration.builder(siteUrl).offlineResourceConfig(offlineConfig); // Grab a user account from the Salesforce Mobile SDK UserAccount userAccount = SalesforceSDKManager.getInstance().getUserAccountManager().getCurrentUser(); if (userAccount != null) { // Create an authorization token provider from the Salesforce Mobile SDK ClientManager.AccMgrAuthTokenProvider authTokenProvider = new ClientManager.AccMgrAuthTokenProvider( SalesforceSDKManager.getInstance().getClientManager(), userAccount.getInstanceServer(), userAccount.getAuthToken(), userAccount.getRefreshToken()); // Create a wrapper with the Salesforce Mobile SDK token provider AuthTokenProvider provider = new MobileSdkAuthTokenProvider(authTokenProvider, userAccount.getAuthToken()); // Build a config using the token provider and the authenticated user builder.withAuthConfig(provider, new MobileSdkUser(userAccount)); } // And now build a configuration object! KnowledgeConfiguration config = builder.build(); This code sample illustrates how it works with Case Management: // Create Case Management configuration builder CaseConfiguration.Builder builder = new CaseConfiguration.Builder(SITE\_URL, CREATE\_CASE\_ACTION\_NAME) // Grab a user account from the Salesforce Mobile SDK UserAccount userAccount = SalesforceSDKManager.getInstance().getUserAccountManager().getCurrentUser(); if (userAccount != null) { // Create an authorization token provider from the Salesforce Mobile SDK ClientManager.AccMgrAuthTokenProvider authTokenProvider = new ClientManager.AccMgrAuthTokenProvider( SalesforceSDKManager.getInstance().getClientManager(), userAccount.getInstanceServer(), userAccount.getAuthToken(), userAccount.getRefreshToken()); // Create a wrapper with the Salesforce Mobile SDK token provider AuthTokenProvider provider = new MobileSdkAuthTokenProvider(authTokenProvider, userAccount.getAuthToken()); // Build a config using the token provider and the authenticated user builder.withAuthConfiguration(provider, new MobileSdkUser(userAccount)) .caseListName(CASE\_LIST\_NAME); } // Create a core configuration instance CaseConfiguration coreConfiguration = builder.build(); At this point, you can use the features of the Service Chat SDK as an authenticated user. # Authentication with the for Android for Android The Service Chat SDK provides an authentication mechanism that allows your users to access user-specific information in Service Cloud. To authenticate, implement two interfaces and provide an access token to the SDK. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). AuthenticatedUser [AuthenticatedUser](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/http/AuthenticatedUser.html) contains information about the user who wants to be authenticated. public interface AuthenticatedUser { @NonNull String getUserId (); } AuthTokenProvider [AuthTokenProvider](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/http/AuthTokenProvider.html) is an interface to the system that obtains the access token. If the access token expires, the Service Chat SDK asks your implementation to refresh the token. public interface AuthTokenProvider { @Nullable String getToken (); @Nullable String getTokenType (); boolean canRefresh (); void refreshToken (@NonNull ResponseSummary responseSummary); } The following sequence diagram describes the basic authentication flow. ![OAuth diagram](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/android-oauth-diagram.png) If you're using the Salesforce Mobile SDK, you can implement these classes as wrappers to existing authentication features. See [Authenticating Using the Salesforce Mobile SDK](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_authentication_mobilesdk.htm "These instructions describe how to authenticate the Service Chat SDK using the provided authentication mechanism within the Salesforce Mobile SDK.") for more information. If you're not using the Salesforce Mobile SDK, make sure that your implementation can access whatever authorization server you're using to obtain the access token. - **[Authenticating Using the Salesforce Mobile SDK](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_authentication_mobilesdk.htm)** These instructions describe how to authenticate the Service Chat SDK using the provided authentication mechanism within the Salesforce Mobile SDK. # Block Sensitive Data in a Chat Session To block sending sensitive data to agents, specify a regular expression in your org's setup. When the regular expression matches text in the user's message, the matched text is replaced with customizable text before it leaves the device. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). To learn more, see [Block Sensitive Data in Chats](https://help.salesforce.com/articleView?id=live_agent_block_sensitive_data.htm&language=en_US). # Build Your Own UI with the Chat Core API With the Chat Core API, you can access the functionality of Chat without a UI. This API is useful if you want to build your own UI and not use the default. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). Before starting, make sure that you’ve already: - Set up Service Cloud to work with Chat. See [Org Setup for Chat in Lightning Experience with a Guided Flow](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/live_agent_cloud_setup.htm "Use the guided setup flow in Lightning Experience to add chat to your org."). - Installed the SDK. See [Install the Service SDK for Android](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_install_sdk.htm "Install the Service SDK for Android using Gradle."). These steps describe how to use the Chat Core API. To use the default UI, see [Quick Setup: Chat in the](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_chat_basic_setup.htm "To add Chat to your Android app, create a configuration object that points to your org and then create a Chat UI client."). 1. To listen for agent activity, create an [AgentListener](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/AgentListener.html) implementation. From the agent listener, you can: - Detect when an agent has joined using onAgentJoined(AgentInformation agentInformation). - Detect when an agent is typing a message using onAgentIsTyping(boolean isAgentTyping). - Receive an incoming message from an agent using onChatMessageReceived(ChatMessage chatMessage). 2. To listen for session state changes, create a [SessionStateListener](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/SessionStateListener.html). From a session state listener, you can: - Detect when the session state changes using onSessionStateChange(ChatSessionState state). For example, this method is useful for when the session disconnects (ChatSessionState.Disconnected). - Detect when the session ends using onSessionEnded(ChatEndReason endReason). This method is useful to know why a session ends and report the information to the user. For example, ChatEndReason.EndedByAgent is passed when the agent ends the session. To learn more about using this listener, see [Listen for State Changes and Events](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_chat_state_changes.htm "You can add listeners for state changes and events during a chat session and respond accordingly. For instance, when the client ends a session, you can display a dialog to the user."). 3. To listen for changes related to a user's position or estimated wait time in the agent queue, create a [QueueListener](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/QueueListener.html). When a user is trying to connect to an agent, you can monitor where the user is in the queue. The estimated wait time is returned in minutes and the queue position is an integer value related to the overall agent capacity. When using the queue position number, the queue position is 0 if the agent capacity is greater than or equal to the number of customer requests. Otherwise, the position value represents how far the customer is from getting served by an agent. q = max(n - c, 0) Where: - q is the queue position - n is the position of the customer compared to all waiting customers - c is the total capacity of all agents For example, if the total capacity is 10, the first 10 waiting visitors have a position of 0, the 11th has a position of 1, the 12th has a position of 2, and so on. 4. To listen for Einstein bot activity, create a ChatBotListener. From a bot listener, you can: - Detect when you receive a persistent footer menu from the Einstein bot with onChatFooterMenuReceived. A footer menu is always accessible to the user and typically handles options that are not context-specific, such as "Transfer to agent." - Detect when you receive menu options from the Einstein bot with onChatMenuReceived. - Detect when you receive choice button options from the Einstein bot with onChatButtonMenuReceived. 5. Build a [ChatConfiguration](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatConfiguration.html) object as described in [Quick Setup: Chat in the](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_chat_basic_setup.htm "To add Chat to your Android app, create a configuration object that points to your org and then create a Chat UI client."). In Java: // Create a core configuration instance ChatConfiguration chatConfiguration = new ChatConfiguration.Builder(ORG\_ID, BUTTON\_ID, DEPLOYMENT\_ID, LIVE\_AGENT\_POD) .build(); In Kotlin: // Create a core configuration instance val chatConfiguration = ChatConfiguration.Builder(ORG\_ID, BUTTON\_ID, DEPLOYMENT\_ID, LIVE\_AGENT\_POD) .build() 6. Create a [ChatCore](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatCore.html) object with your chat configuration object. In Java: ChatCore core = ChatCore.configure(chatConfiguration); In Kotlin: val core = ChatCore.configure(chatConfiguration) 7. Create a [ChatClient](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatClient.html), adding your listener objects. Define [ChatClient](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatClient.html) at the Application scope to ensure that the session is trackable throughout the application's lifetime rather than just within an Activity, for example. In Java: private @Nullable ChatClient mChatClient; // ... core.createClient(this) .onResult(new Async.ResultHandler() { @Override public void handleResult (Async operation, @NonNull ChatClient chatClient) { mChatClient = chatClient .addSessionStateListener(myStateListener) .addAgentListener(myAgentListener) .addQueueListener(myQueueListener) .addChatBotListener(myEinsteinBotListener); } }); In Kotlin: var mChatClient: ChatClient? = null // ... core.createClient(this) .onResult { operation, chatClient -> mChatClient = chatClient .addSessionStateListener(myStateListener) .addAgentListener(myAgentListener) .addQueueListener(myQueueListener) .addChatBotListener(myEinsteinBotListener) } When you receive a chat client instance, a session has successfully started. 8. Perform session actions with the [ChatClient](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatClient.html) object. From the chat client object, you can perform the following functions: - Tell the agent when the user is typing a message using setIsUserTyping(boolean isUserTyping). - Send a message to the agent using sendChatMessage(String message). - Handle file transfer activity using addFileTransferRequestListener(FileTransferRequestListener fileTransferRequestListener). See [Transfer File to Agent](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_chat_file_transfer.htm "Give users the ability to transfer files during a chat so they can share information about their issues."). - Handle Einstein bot responses with sendFooterMenuSelection, sendMenuSelection, and sendButtonSelection. - End the chat session using endChatSession(). # Can't Connect to Chat If you can't make a successful connection from your app, even when an agent is standing by, review how you've set up your chat implementation. Run through this checklist to help diagnose the root cause. 1. If you’re using the default UI for chat, verify that you are calling showChat on the main UI thread. 2. Verify that the chat endpoint in your code only specifies the hostname. For instance, if your endpoint is https://MyDomainName.my.salesforce-scrt.com/chat/rest/, then use the following value in your code: MyDomainName.my.salesforce-scrt.com. 3. Verify that you're using the correct chat endpoint. See [Get Chat Settings from Your Org](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/live_agent_cloud_setup_get_settings.htm#live_agent_cloud_setup_get_settings "After you’ve set up chat in the console, supply your app developer with four values: the chat endpoint hostname, the organization ID, the deployment ID, and the button ID. You can get this information from your org’s setup.") for more info. 4. Verify that you're using the correct deployment ID and button ID. See [Get Chat Settings from Your Org](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/live_agent_cloud_setup_get_settings.htm#live_agent_cloud_setup_get_settings "After you’ve set up chat in the console, supply your app developer with four values: the chat endpoint hostname, the organization ID, the deployment ID, and the button ID. You can get this information from your org’s setup.") for more info. 5. Verify that you've correctly set up your chat implementation. See [Org Setup for Chat in Lightning Experience with a Guided Flow](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/live_agent_cloud_setup.htm "Use the guided setup flow in Lightning Experience to add chat to your org.") for more info. # Chat in the for Android for Android Using Chat within the Service Chat SDK, you can provide real-time chat sessions from within your native app. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). Once you’ve [set up chat for Service Cloud](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/live_agent_cloud_setup.htm "Use the guided setup flow in Lightning Experience to add chat to your org."), it takes [just a few calls to the SDK](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_chat_basic_setup.htm "To add Chat to your Android app, create a configuration object that points to your org and then create a Chat UI client.") to have your app ready to handle agent chat sessions. When a chat session initiates, it is minimized by default so the user can keep using the app. ![Chat session minimized](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/android_lac_chat_minimized.png) When the user taps the chat thumbnail, the app goes full screen. ![Chat session full screen](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/android_lac_chat_normal.png) If you've implemented Einstein Bots, the user first [speaks with a chat bot](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_chat_einstein_bots.htm#android_chat_einsten_bots "With Einstein Bots, you can complement your chat support experience with a smart, automated system that saves your agents time and keeps your customers happy. Once you've set up Einstein Bots in your org, the SDK automatically begins the chat experience using your bot. You can design your bot to transfer to an agent at any point.") before optionally getting transferred to an agent. If the user isn't using the app during a chat session, they receive a new message notification when an agent sends a message. When an agent sends links to your users, they see link previews right from within the chat session. The SDK tries to use Open Graph meta tags (og:title, og:description, og:image) to extract relevant information for the preview. ![Chat session hyperlinks](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/android_lac_chat_hyperlinks.png) You can also [customize the look and feel](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_customization.htm "Once you’ve played around with some of the SDK features, use this section to learn how to customize the Service Chat SDK so that it fits the look and feel of your app. This section also contains instructions for localizing strings in all supported languages.") of the interface so that it fits naturally within your app. # Check Agent Availability Before starting a session, you can check the availability of your chat agents and then provide your users with more accurate expectations. For instance, when no agents are available, you can hide or disable the button to contact an agent ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). To check whether agents are available, create an [AgentAvailabilityClient](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/AgentAvailabilityClient.html) object and asynchronously check the [AvailabilityState](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/AvailabilityState.html) status. In Java: // Build a configuration object ChatConfiguration chatConfiguration = new ChatConfiguration.Builder(ORG\_ID, BUTTON\_ID, DEPLOYMENT\_ID, LIVE\_AGENT\_POD) .build(); // Create an agent availability client Boolean requestEstimatedWaitTime = false; // Don’t request if we don’t plan to use it AgentAvailabilityClient client = ChatCore.configureAgentAvailability(chatConfiguration, requestEstimatedWaitTime); // Check agent availability client.check().onResult(new Async.ResultHandler() { @Override public void handleResult (Async async, @NonNull AvailabilityState state) { switch (state.getStatus()) { case AgentsAvailable: { // TO DO: Handle the case where agents are available // Optionally, use the estimatedWaitTime to // show an estimated wait time until an agent // is available. This value is only valid // if you request it from the // configureAgentAvailability call above. // Estimate is returned in seconds. Integer ewt = state.getEstimatedWaitTime(); break; } case NoAgentsAvailable: { // TO DO: Handle the case where no agents are available break; } case Unknown: { break; } } }); In Kotlin: // Build a configuration object val chatConfiguration = ChatConfiguration.Builder(ORG\_ID, BUTTON\_ID, DEPLOYMENT\_ID, LIVE\_AGENT\_POD).build() // Create an agent availability client val requestEstimatedWaitTime = false // Don’t request if we don’t plan to use it val client = ChatCore.configureAgentAvailability(chatConfiguration, requestEstimatedWaitTime) // Check agent availability client.check().onResult(object: Async.ResultHandler { override fun handleResult(operation: Async<\*>?, result: AvailabilityState) { when (result.getStatus()) { AvailabilityState.Status.AgentsAvailable -> { // TO DO: Handle the case where agents are available // Optionally, use the estimatedWaitTime to // show an estimated wait time until an agent // is available. This value is only valid // if you request it from the // configureAgentAvailability call above. // Estimate is returned in seconds. val ewt = result.getEstimatedWaitTime() } AvailabilityState.Status.NoAgentsAvailable -> { // TO DO: Handle the case where no agents are available } } } }) To understand the algorithm used for the estimated wait time, see the estimated wait time documentation in the [Chat REST API Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.260.0.live_agent_rest.meta/live_agent_rest/live_agent_rest_estimated_wait_time.htm). You can also use this API to get an updated Chat server before starting a session to determine whether a server has changed for your pod. Call the getLiveAgentPod method from the [AvailabilityState](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/AvailabilityState.html) object you get back from the [AgentAvailabilityClient](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/AgentAvailabilityClient.html). If the server has changed, update this configuration value in the future to prevent an unnecessary round-trip request. # Create or Update Salesforce Records from a Chat Session When a chat session begins, you can create or find records within your org and pass this information to the agent. Using this technique, your agent can immediately have all the context they need for an effective chat session. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). ## Overview Before reading these instructions, review [Show Pre-Chat Fields to User](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_chat_prechat_fields.htm "Before a chat session begins, you can request that the user enter pre-chat fields that are sent to the agent at the start of the session.") to understand how to create pre-chat fields. Pre-chat fields are always sent to the agent at the start of the session. But if you want to fill in fields of a particular record, instantiate a [ChatEntity](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntity.html) for each Salesforce object (for example, Case or Contact) and add a [ChatEntityField](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntityField.html) for each field association within that Salesforce object (for example, Subject or LastName). After you've built your [ChatEntity](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntity.html) objects, pass them to your [ChatConfiguration](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatConfiguration.html) builder using the [chatEntities](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatConfiguration.Builder.html#chatEntities\(java.util.List%3Ccom.salesforce.android.chat.core.model.ChatEntity%3E\)) method. ![Note](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note.png) #### Note Case creation does not currently work for Omni-Channel routing without a setup change to your org. To resolve this problem, raise a ticket with Salesforce to ensure that Omni-Channel is enabled to create a Case in your org. ## Basic Flow This sample shows how to create the first and last name to a contact record in your org. This example doesn't involve user input, but you can use [PreChatTextInputField](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/ui/model/PreChatTextInputField.html) instead of [ChatUserData](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatUserData.html) to allow user input. In Java: // Create chat user data that doesn't require user interaction ChatUserData firstNameData = new ChatUserData("FirstName", "Jane", true); ChatUserData lastNameData = new ChatUserData("LastName", "Doe", true); In Kotlin: // Create chat user data that doesn't require user interacti val firstNameData = ChatUserData("FirstName", "Jane", true) val lastNameData = ChatUserData("LastName", "Doe", true) The first argument is the field label that is displayed to the agent in the transcript. The second argument is the value. The third argument is whether this value is displayed to the agent. After you create your [ChatUserData](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatUserData.html) objects, create a [ChatEntity](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntity.html) for each Salesforce object that you want to associate these values with. The [ChatEntity](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntity.html) object contains a for each field association. When you build this [ChatEntityField](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntityField.html) object, pass in a reference to the associated object. In this example, we create two [ChatEntityField](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntityField.html) objects and one using those two objects. In Java: // Build chat entity fields ChatEntityField firstNameField = new ChatEntityField.Builder().doFind(true) .isExactMatch(true) .doCreate(true) .build("FirstName", firstNameData); ChatEntityField lastNameField = new ChatEntityField.Builder().doFind(true) .isExactMatch(true) .doCreate(true) .build("LastName", lastNameData); // Build a chat entity object from those fields // (to map user data to fields in a Salesforce record) ChatEntity contactEntity = new ChatEntity.Builder() .showOnCreate(true) .addChatEntityField(firstNameField) .addChatEntityField(lastNameField) .build("Contact"); In Kotlin: // Build chat entity fields val firstNameField = ChatEntityField.Builder().doFind(true) .isExactMatch(true) .doCreate(true) .build("FirstName", firstNameData) val lastNameField = ChatEntityField.Builder().doFind(true) .isExactMatch(true) .doCreate(true) .build("LastName", lastNameData) // Build a chat entity object from those fields // (to map user data to fields in a Salesforce record) val contactEntity = ChatEntity.Builder() .showOnCreate(true) .addChatEntityField(firstNameField) .addChatEntityField(lastNameField) .build("Contact") When creating the [ChatEntityField](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntityField.html) object, you can specify whether to search for that field (doFind), whether the match must be exact (isExactMatch), and whether to create a new record if not found (doCreate). When creating the [ChatEntity](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntity.html) object, along with the name of the Salesforce object and the list of fields, you can specify whether the contact should pop up for the agent upon creation (showOnCreate). See the reference documentation for [ChatEntity](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntity.html) and [ChatEntityField](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntityField.html). Also refer to [Chat REST API Data Types](https://developer.salesforce.com/docs/atlas.en-us.260.0.live_agent_rest.meta/live_agent_rest/live_agent_rest_data_types.htm) for the Entity and EntityFieldsMaps data types, which define the underlying functionality of these SDK objects. After you've built your [ChatEntity](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/model/ChatEntity.html) objects, pass them to your [ChatConfiguration](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatConfiguration.html) builder using the [chatEntities](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.3.1/api/reference/com/salesforce/android/chat/core/ChatConfiguration.Builder.html#chatEntities\(java.util.List%3Ccom.salesforce.android.chat.core.model.ChatEntity%3E\)) method. In Java: // Create the chat configuration builder final ChatConfiguration.Builder chatConfigurationBuilder = new ChatConfiguration.Builder(ORG\_ID, BUTTON\_ID, DEPLOYMENT\_ID, LIVE\_AGENT\_POD); // Add user data and entities chatConfigurationBuilder .chatUserData(firstNameData, lastNameData) .chatEntities(contactEntity); // Build the chat configuration object ChatConfiguration chatConfiguration = chatConfigurationBuilder.build(); In Kotlin: // Create the chat configuration builder val chatConfigurationBuilder = ChatConfiguration.Builder(ORG\_ID, BUTTON\_ID, DEPLOYMENT\_ID, LIVE\_AGENT\_POD) // Add user data and entities chatConfigurationBuilder .chatUserData(firstNameData, lastNameData) .chatEntities(contactEntity) // Build the chat configuration object val chatConfiguration = chatConfigurationBuilder.build() ## Example This code sample adds FirstName, LastName, Email to a Contact record and a Subject field to a Case record. In Java: // Create some hidden fields with specific values ChatUserData firstNameData = new ChatUserData( "FirstName", "Jane", true); ChatUserData lastNameData = new ChatUserData( "LastName", "Doe", true); ChatUserData emailData = new ChatUserData( "Email", "jane.doe@salesforce.com", true); ChatUserData subjectData = new ChatUserData( "Subject", "Chat Session", true); // Map Subject to a field in a Case record ChatEntity caseEntity = new ChatEntity.Builder() .showOnCreate(true) .linkToTranscriptField("Case") .addChatEntityField( new ChatEntityField.Builder() .doFind(true) .isExactMatch(true) .doCreate(true) .build("Subject", subjectData)) .build("Case"); // Map FirstName, LastName, and Email to fields in a Contact record ChatEntity contactEntity = new ChatEntity.Builder() .showOnCreate(true) .linkToTranscriptField("Contact") .linkToAnotherSalesforceObject(caseEntity, "ContactId") .addChatEntityField( new ChatEntityField.Builder() .doFind(true) .isExactMatch(true) .doCreate(true) .build("FirstName", firstNameData)) .addChatEntityField( new ChatEntityField.Builder() .doFind(true) .isExactMatch(true) .doCreate(true) .build("LastName", lastNameData)) .addChatEntityField( new ChatEntityField.Builder() .doFind(true) .isExactMatch(true) .doCreate(true) .build("Email", emailData)) .build("Contact"); // Create the chat configuration builder final ChatConfiguration.Builder chatConfigurationBuilder = new ChatConfiguration.Builder(ORG\_ID, BUTTON\_ID, DEPLOYMENT\_ID, LIVE\_AGENT\_POD); // Add user data and entities chatConfigurationBuilder .chatUserData(firstNameData, lastNameData, emailData, subjectData) .chatEntities(caseEntity, contactEntity); // Build the chat configuration object ChatConfiguration chatConfiguration = chatConfigurationBuilder.build(); In Kotlin: // Create chat user data that doesn't require user interaction val firstNameData = ChatUserData( "FirstName", "Jane", true) val lastNameData = ChatUserData( "LastName", "Doe", true) val emailData = ChatUserData( "Email", "jane.doe@salesforce.com", true) val subjectData = ChatUserData( "Subject", "Chat Session", true) // Map Subject to a field in a Case record val caseEntity = ChatEntity.Builder() .showOnCreate(true) .linkToTranscriptField("Case") .addChatEntityField( ChatEntityField.Builder() .doFind(true) .isExactMatch(true) .doCreate(true) .build("Subject", subjectData)) .build("Case") // Map FirstName, LastName, and Email to fields in a Contact record val contactEntity = ChatEntity.Builder() .showOnCreate(true) .linkToTranscriptField("Contact") .linkToAnotherSalesforceObject(caseEntity, "ContactId") .addChatEntityField( ChatEntityField.Builder() .doFind(true) .isExactMatch(true) .doCreate(true) .build("FirstName", firstNameData)) .addChatEntityField( ChatEntityField.Builder() .doFind(true) .isExactMatch(true) .doCreate(true) .build("LastName", lastNameData)) .addChatEntityField( ChatEntityField.Builder() .doFind(true) .isExactMatch(true) .doCreate(true) .build("Email", emailData)) .build("Contact") // Create the chat configuration builder val chatConfigurationBuilder = ChatConfiguration.Builder(ORG\_ID, BUTTON\_ID, DEPLOYMENT\_ID, LIVE\_AGENT\_POD) // Add user data and entities chatConfigurationBuilder .chatUserData(firstNameData, lastNameData, emailData, subjectData) .chatEntities(caseEntity, contactEntity) // Build the chat configuration object val chatConfiguration = chatConfigurationBuilder.build() # Customize and Localize Strings with the You can change the text throughout the user interface. To customize text, create string resource XML files (named strings.xml) in your project's values-\[locale\] resource folder for the language(s) you want to update. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). To see the complete list of string resource values, refer to the string resources document for the feature you want to customize. - [Chat String Resources](https://forcedotcom.github.io/ServiceSDK-Android/releases/chat/4.1.1/api/reference/doc-files/resource_overrides.html#Strings) - [Common String Resources](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.2/api/reference/doc-files/resource_overrides.html#Strings) SDK text is translated into more than 25 different languages. In order for your string customizations to take effect in all languages, provide a translation for each language. To add support for a language, create a resources subdirectory that includes a hyphen and the ISO language code at the end of the directory name. For example, values-es/ is the directory containing string resources for Spanish. Android loads the appropriate resources according to the locale settings of the device at run time. The system falls back on the strings in the default values/ directory if the appropriate locale directory isn't found. The following languages are currently supported: Table 1. Supported Languages | Language Code | Language | | --- | --- | | values-ar | Arabic | | values-cs | Czech | | values-da | Danish | | values-de | German | | values-el | Greek | | values-en | English | | values-es | Spanish | | values-fi | Finnish | | values-fr | French | | values-hu | Hungarian | | values-in | Indonesian | | values-it | Italian | | values-iw | Hebrew | | values-ja | Japanese | | values-ko | Korean | | values-nl | Dutch | | values-no | Norwegian | | values-pl | Polish | | values-pt-rBR | Brazilian Portuguese | | values-ro | Romanian | | values-ru | Russian | | values-sv | Swedish | | values-th | Thai | | values-tr | Turkish | | values-uk | Ukranian | | values-vi | Vietnamese | | values-zh | Chinese | | values-zh-rTW | Traditional Chinese | Check out [Supporting Different Languages](http://developer.android.com/training/basics/supporting-devices/languages.html) in the Android Developer documentation for more info about localization. ## Example To learn how you can change string values, let's go through an example. The image below shows the default connection prompt dialog text in English: ![Original string](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/android_strings_dialog_start_session.png) You can change the title and body of this dialog by changing the sos\_title and the sos\_connect\_prompt strings in the strings.xml file in the values folders for your locale (values-en/ for English): Live Help We can connect you with an agent who can troubleshoot your problems Now, whenever you start a session you see the updated dialog text: ![Modified string](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/android_strings_dialog_string_override.png) # Customize Chat Images with the Specify custom images used throughout the chat UI. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). The Service Chat SDK allows you to customize chat images in the UI. If you want to change an image, override the Drawable for the image you want to customize using the exact same file name. The following table contains a list of the most common overridable images. | Image File Name | Description | | --- | --- | | chat\_ic\_footer\_menu.xml | Hamburger menu on the bottom of the window, next to the chat input. (48dp x 48dp) | | chat\_ic\_minimized\_connecting.xml | Connecting icon when the view is minimized. (32dp x 29dp) | | chat\_minimized\_message\_indicator.xml | Chat bubble unread indicator when the view is minimized. (27dp x 24dp) | | common\_ic\_close.xml | Close button at the top left of the window. (24dp x 24dp) | | salesforce\_agent\_avatar.xml | Agent avatar used beside the agent’s chat bubble. (36dp x 36dp) | | salesforce\_ic\_message\_send.xml | Send message button next to chat input. (24dp x 24dp) | | salesforce\_ic\_minimize.xml | Minimize button at the top right of the window. (18dp x 18dp) | ![Note](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note.png) #### Note To customize the chat bot avatar and the bot banner, see [Use Einstein Bots with Chat](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_chat_einstein_bots.htm "With Einstein Bots, you can complement your chat support experience with a smart, automated system that saves your agents time and keeps your customers happy. Once you've set up Einstein Bots in your org, the SDK automatically begins the chat experience using your bot. You can design your bot to transfer to an agent at any point."). For instance, if you’d like to override the agent avatar during a chat session, add a Drawable to your res/drawables folder with the name salesforce\_agent\_avator.xml. This value should contain image info about the agent avatar. The following list contains _all_ the customizable Drawables used throughout the chat UI: chat\_button.xml, chat\_button\_pressed.xml, chat\_footer\_menu\_item.xml, chat\_ic\_bubble.xml, chat\_ic\_close.xml, chat\_ic\_collapse.xml, chat\_ic\_footer\_menu.xml, chat\_ic\_last\_photo.xml, chat\_ic\_minimized\_connecting.xml, chat\_ic\_photo\_gallery.xml, chat\_menu\_bottom\_button.xml, chat\_menu\_button.xml, chat\_menu\_header.xml, chat\_menu\_solo\_button.xml, chat\_menu\_speech\_arrow.xml, chat\_menu\_top\_button.xml, chat\_minimized\_message\_indicator.xml, agent\_initial\_avatar.xml, link\_preview\_arrow.xml, progress\_indeterminate\_horizontal\_material.xml, salesforce\_agent\_avatar.xml, salesforce\_button.xml, salesforce\_button\_solid.xml, salesforce\_horizontal\_rule.xml, salesforce\_ic\_camera.xml, salesforce\_ic\_message\_send.xml, salesforce\_ic\_minimize.xml, salesforce\_loading\_ball.xml, salesforce\_message\_bubble\_overlay.xml, salesforce\_message\_bubble\_received.xml, salesforce\_message\_bubble\_received\_speech\_arrow.xml, salesforce\_message\_bubble\_sent.xml, salesforce\_minimized\_view.xml, salesforce\_minimized\_view\_toolbar.xml, vector\_drawable\_progress\_indeterminate\_horizontal.xml. # Customize Colors with the You can customize the look and feel of the interface by specifying the colors used throughout the UI. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). To customize the colors, create color resource values in your project's colors.xml file that correspond to the same resource names specified in this documentation. For example, the following resource file values customize some of the branding tokens: #50e3c2 #4a90e2 #ffffff #333333 #767676 #e74c3c These screenshots illustrate how the branding tokens affect the UI. Chat UI Branding: ![Branding colors for Chat](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/branding-chat-android.png) The following branding tokens are available for customization.
Token Name Default Value Description / Sample Uses
Toolbar

salesforce_toolbar

#FAFAFA

Toolbar

The toolbar background color.

Toolbar Inverted

salesforce_toolbar_inverted

#010101

Toolbar inverted

Toolbar text and icon color.
Brand Primary

salesforce_brand_primary

#007F7F

Brand primary

The banner background color.

Chat: Line under the message you’re typing.

Brand Secondary

salesforce_brand_secondary

#2872CC

Brand secondary

Chat: User text bubbles.

Brand Contrast

salesforce_brand_contrast

#FCFCFC

Secondary inverted

Title text color.

Contrast Primary

salesforce_contrast_primary

#000000

Contrast primary

Primary body text color.

Contrast Secondary

salesforce_contrast_secondary

#6D6D6D

Contrast secondary

Contrast Tertiary

salesforce_contrast_tertiary

#BABABA

Contrast tertiary

Contrast Quaternary

salesforce_contrast_quaternary

#F1F1F1

Contrast quaternary

Chat: Background color for the chat feed screen.
Contrast Inverted

salesforce_contrast_inverted

#FFFFFF

Contrast inverted

Page background, navigation bar, table cell background.

Chat: Color of the close button on the minimized view. Client message text. Background color at the bottom of the input bar on the chat feed UI.

Feedback Primary

salesforce_feedback_primary

#E74C3C

Feedback primary

Text color for error messages.

Feedback Secondary

salesforce_feedback_secondary

#2ECC71

Feedback secondary

Feedback Tertiary

salesforce_feedback_tertiary

#F5A623

Feedback tertiary

Title Color

salesforce_title_color

#FBFBFB

Primary inverted

Text as it appears in titles throughout the UI. Text on areas where a brand color is used for the background.

Chat: Agent text bubbles.

Overlay

salesforce_overlay

#000000

(40% alpha)

# Data Collection for the The Service Chat SDK collects and transmits data to perform basic operations. This data falls into three categories: pre-chat data, chat message data, and logging data. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). ## Pre-Chat Data Data types collected: - Personal info (for example, name, email). Most pre-chat forms contain some personal info. - Other info. Other data collected depends on how you design your pre-chat form. All data specified in the pre-chat form is securely transmitted to your Salesforce org using HTTPS communication (TLS 1.3). This data is stored in your org indefinitely, depending on how you handle pre-chat information in your org. You can change this behavior from within your org. You can even remove the pre-chat form altogether. ## Chat Message Data Data types collected: - In-app messages. User chat messages get sent to agents through your Salesforce org. - Photos. Users can send photos to agents. - Other info. Any content a user types into a message gets sent to an agent or chatbot. All user messages are securely transmitted to your Salesforce org using HTTPS communication (TLS 1.3). This data is stored in your org indefinitely. You can remove any of this data from your org. ## Logging Data Data types collected: - App interactions - Other actions For logging purposes, we send anonymized information to Splunk servers using HTTPS communication (TLS 1.3). This data doesn't contain any customer-identifiable or hardware-identifiable information. We log info about how users interact with the SDK and we log some basic system information (such as battery stats) while they use the SDK. # Data Protection and Security in the for Android for Android The Service Chat SDK does not collect or store personal data from its users. We ensure that data is secure both locally and when in transit. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). - **Secure data at rest**. We don't store personal data about the user. We manage keys using the Android Keystore. All content fetched from Salesforce servers is stored locally using AES-256 encryption. - **Secure data in transit**. All network communication occurs over SSL using TLS 1.2. # Decrease the Size of Your App Although the SDK doesn't have a large footprint, you can decrease the size of your app by splitting your APK or by using ProGuard. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). The SOS SDK contains native libraries for a variety of architectures, so it can benefit from APK splitting. See the [Android documentation on splitting your APK](https://developer.android.com/studio/build/configure-apk-splits.html). You can also use [ProGuard](https://sourceforge.net/projects/proguard/) to shrink and optimize your app. Use the following ProGuard rules as a starting point. ################# ALL ################# # ------------------ OkHttp -------------------------- -dontwarn okio.\*\* -dontwarn okhttp3.\*\* -dontwarn javax.annotation.\*\* -dontwarn org.conscrypt.\*\* -keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase # ------------------ SQLCipher ------------------------ # If you're only using Chat, you can remove the sqlcipher rules -keep class net.sqlcipher.\*\* { \*; } -dontwarn net.sqlcipher.\*\* # ------------------ Gson ---------------------------- -keepclassmembers,allowobfuscation class \* { @com.google.gson.annotations.SerializedName ; } # Embedded Service Chat SDK for Android Developer Guide Developer Guide The Embedded Service Chat SDK for Mobile Apps makes it easy to give customers access to powerful chat features right from within your native app. This guide helps you get started using the SDK in your mobile app. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). **October 2023 Release (Version 224.2.6)** This documentation describes the | Component | Version Number | | --- | --- | | Chat | 4.3.6 | | Common | 8.0.6 | - **[Release Notes](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_release_notes.htm)** Check out the new features and known issues for the Android Service Chat SDK . - **[Service Cloud Setup for the](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/servicesdk_cloud_setup.htm)** Set up Service Cloud in your org before using the Service Chat SDK. - **[Setup Setup](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/servicesdk_sdk_setup.htm)** Set up the SDK to start using Service Cloud features in your mobile app. - **[Android Examples](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/servicesdk_android_tutorials.htm)** Use these examples to learn more about the Service Chat SDK. - **[Using Chat with the](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/servicesdk_using_live_agent.htm)** Add the Chat experience to your mobile app. - **[SDK Customizations with the for Android for Android](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_customization.htm)** Once you’ve played around with some of the SDK features, use this section to learn how to customize the Service Chat SDK so that it fits the look and feel of your app. This section also contains instructions for localizing strings in all supported languages. - **[Troubleshooting the](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/servicesdk_troubleshooting.htm)** Get some guidance when you run into issues. - **[Data Protection and Security in the for Android for Android](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/android_data_protection.htm)** The Service Chat SDK does not collect or store personal data from its users. We ensure that data is secure both locally and when in transit. - **[Reference Documentation](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/servicesdk_android_ref_overview.htm)** Reference documentation for Service Chat SDK for Android. - **[Additional Resources](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/servicesdk_additional_resources.htm)** If you’re looking for other resources, check out this list of links to related documentation. #### See Also - [Service SDK for Android Release Notes](https://github.com/forcedotcom/ServiceSDK-Android/releases "Service SDK for Android Release Notes - HTML (New Window)") - [Service SDK for Android Reference Documentation](https://forcedotcom.github.io/ServiceSDK-Android/ "Service SDK for Android Reference Documentation - HTML (New Window)") - [Service SDK for iOS Developer Guide](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_ios.meta/service_sdk_ios/servicesdk_ios_dev_guide.htm "Service SDK for iOS Developer Guide - HTML (New Window)") # Enable Debug Logging for the Android SDK SDK logs are disabled by default. To enable logging, you add a sink and then specify a log level. Call [addSink](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/utilities/logging/ServiceLogging.html#addSink\(com.salesforce.android.service.common.utilities.logging.ServiceLoggingSink\)) to direct the debug logs to the specified sink. LOG\_CAT\_SINK directs all log messages to the Android logcat using the standard Log. calls. Set the log level with [setLogLevel](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/utilities/logging/ServiceLogging.html#setLogLevel\(int\)). For example: ServiceLogging.addSink(ServiceLogging.LOG\_CAT\_SINK); ServiceLogging.setLogLevel(ServiceLogging.LEVEL\_TRACE); To direct the logs somewhere other than logcat, implement your own [ServiceLoggingSink](https://forcedotcom.github.io/ServiceSDK-Android/releases/common/8.0.5/api/reference/com/salesforce/android/service/common/utilities/logging/ServiceLoggingSink.html). To learn more about Android logging, see [Write and View Logs](https://developer.android.com/studio/debug/am-logcat.html). # Error Using the Salesforce Mobile SDK with the If you're trying to build a Service Chat SDK project that explicitly embeds the Salesforce Mobile SDK, exclude these two maven dependencies to prevent conflicts. When building an app with both SDKs, you may encounter an error such as this error: Error: more than one library with package name 'com.salesforce.androidsdk.analytics' Or this error: Duplicate zip entry \[classes.jar:com/salesforce/androidsdk/smartstore/app/SmartStoreSDKManager.class\] To solve the problem, exclude the problematic dependencies from your build.gradle file. compile('com.salesforce.service:servicesdk:224.2.6') { exclude group: 'com.salesforce.mobilesdk', module: 'SmartStore' exclude group: 'com.salesforce.mobilesdk', module: 'SalesforceSDK' } # Get Chat Settings from Your Org After you’ve set up chat in the console, supply your app developer with four values: the chat endpoint hostname, the organization ID, the deployment ID, and the button ID. You can get this information from your org’s setup. ![Important](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note_important.png) #### Important The legacy chat product is scheduled for retirement on February 14, 2026, and is in maintenance mode until then. During this phase, you can continue to use chat, but we no longer recommend that you implement new chat channels. To avoid service interruptions to your customers, migrate to [Messaging for In-App and Web](https://help.salesforce.com/s/articleView?id=service.miaw_intro_landing.htm&type=5&language=en_US) before that date. Messaging offers many of the [chat features that you](https://help.salesforce.com/s/articleView?id=service.miaw_chat_vs_messaging.htm&type=5&language=en_US) love plus asynchronous conversations that can be picked back up at any time. Learn about chat retirement in [Help](https://help.salesforce.com/s/articleView?id=001790618&type=1&language=en_US). ![Note](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/icon_note.png) #### Note If the endpoint for your server changes (due to an org migration, for example), the SDK automatically reroutes you to the correct server. However, to avoid unnecessary rerouting, you should still update the server endpoint when you notice it has changed inside your org’s settings. Chat Endpoint Hostname The hostname for the Chat endpoint that your organization has been assigned. To get this value, from Setup, search for **Chat Settings** and copy the hostname from the **API Endpoint**. ![Pod hostname](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/chat_org_pod_hostname.png) Be sure not to include the protocol or the path. For instance, if the API Endpoint is: https://d.gla5.gus.salesforce.com/chat/rest/ The chat endpoint hostname is: d.gla5.gus.salesforce.com Org ID The Salesforce org ID. To get this value, from Setup, search for **Company Information** and copy the **Salesforce Organization ID**. ![Org ID](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/chat_org_org_id.png) Deployment ID The unique ID of your Chat deployment. To get this value, from Setup, select **Chat** | **Deployments**. The script at the bottom of the page contains a call to the liveagent.init function with the **pod**, the **deploymentId**, and **orgId** as arguments. Copy the **deploymentId** value. ![Deployment ID](https://developer.salesforce.com/docs/atlas.en-us.service_sdk_android.meta/service_sdk_android/images/chat_org_deployment_id.png) For instance, if the deployment code contains the following information: