Set Up Agentforce Voice for Android

Agentforce Voice lets you build voice-enabled agents that manage complex conversations in real time. Set up Agentforce Voice for your Android mobile app with these steps.

Before You Begin 

Before you set up Agentforce Voice for your mobile app, create and configure a voice-enabled service agent in Agentforce Studio.

Voice settings are configured at the agent level and apply across all supported connections.

Choose a Connection Path 

The Agentforce Mobile SDK supports two connection paths for voice. Choose based on your requirements. Both paths require enableVoice: true in your SDK feature flags, configured in the next section.

Agent API (Telephony)Enhanced Chat v2 (Service Cloud)
SetupAdd a Telephony connection in Agentforce StudioCreate an Embedded Service Deployment with an ECv2 channel
Human escalationNot supportedSupported — agent can hand off to a live agent
Transcript loggingNot availableAvailable through Service Cloud
RoutingDirect to agentOmni-Channel routing with queue fallback
Voice mode UIAlways available when voice is enabledAppears after the agent joins the session

Agent API (Telephony Connection) 

Use this path for a lightweight integration that gets voice running with minimal server-side configuration. In Agentforce Studio, add a Telephony connection to your service agent to unlock voice settings. This “Agent API” refers to the mobile SDK’s internal connection to the agent — it’s not the same as the Agentforce Agent API used for headless server-to-server integrations. This path doesn’t require a full Service Cloud Voice telephony setup. It just activates the agent-level voice configuration for use with the mobile SDK.

  1. In Agentforce Studio, open your service agent.
  2. Go to Connections and click Add.
  3. Select Telephone and save.
  4. Configure voice settings (voice persona, language) in the agent’s voice settings panel.

Enhanced Chat v2 (Service Cloud Connection) 

This path enables richer capabilities including human escalation and transcript logging. It requires an Embedded Service Deployment with an ECv2 channel that has voice enabled.

  1. In Agentforce Studio, open your service agent.
  2. Go to Connections and click Add.
  3. Select Enhanced Chat V2, then save and activate.
  4. Go to the ECv2 connection’s Routing section and create a new channel.
  5. In the channel settings, select Allow Voice in Enhanced Chat and publish.
  6. Create a Mobile Embedded Service Deployment using that channel.

For the ECv2 path, use the Service API URL and ES Developer Name from your Embedded Service Deployment when configuring the SDK. See Before You Begin for where to find these values.

For more information, see Connect a Service Agent to Enhanced Chat v2.

After configuring your connection path, install the voice module and set up the client below. The SDK configuration is the same regardless of which path you chose.

Install the Agentforce Voice Module 

Starting with SDK version 260.4, Agentforce Voice is a separate optional module. To use Agentforce Voice, add the agentforce-sdk-voice dependency to your build.gradle file alongside the core SDK.

Add Agentforce Voice to build.gradle
1// Core SDK (required)
2implementation("com.salesforce.android:agentforce-sdk:15.x.x")
3
4// Voice support (optional) — includes Agentforce Voice native libs
5implementation("com.salesforce.android:agentforce-sdk-voice:15.x.x")

Then, register the voice module in your configuration:

Register Voice Module
1.setAgentforceVoiceModule(AgentforceVoiceProviderFactory(), AgentforceVoiceUIProvider())

If you don’t use Agentforce Voice, no changes are needed — voice is no longer bundled with the core SDK by default.

Create the AgentforceClient 

To enable Agentforce Voice for Android in your AgentforceConfiguration, use setFeatureFlagSettings.

Enable Voice Feature Flag
1// Sample configuration
2val agentforceConfiguration = AgentforceConfiguration.builder(
3    authCredentialProvider = object : AgentforceAuthCredentialProvider {
4        override fun getAuthCredentials(): AgentforceAuthCredentials {
5            return AgentforceAuthCredentials.Guest(
6                settingsManager.voiceForceConfigEndpoint.value
7            )
8        }
9    }
10)
11.setApplication(this.application)
12
13// Set Connection Info
14.setConnectionInfo(
15    AgentforceConnectionInfo(
16        sfapUrl = settingsManager.voiceSfapURL.value
17    )
18)
19
20// Enable the Voice feature flag(s)
21.setFeatureFlagSettings(
22    AgentforceFeatureFlagSettings.builder()
23        .enableVoice(true) // Enable the voice flag
24        .enableMultiModalInput(enableMultiModal) // Optional flags
25        .build()
26)

To set your permissions manager, use setPermission.

Set Permissions Manager
1.setPermission(AgentforceDefaultPermissions(this.activity))

To set your voice manager, use setVoiceManaging.

Set Voice Manager
1.setVoiceManaging(AgentforceVoiceManaging())
2.build()

To initialize the AgentforceClient, use the configuration object you created.

Initialize AgentforceClient
1// Create your client object
2val agentforceClient = AgentforceClient()
3
4// Initialize the client
5agentforceClient.init(
6    authCredentialProvider =
7        agentforceConfiguration.authCredentialProvider,
8    agentforceMode =
9        AgentforceMode.FullConfig(agentforceConfiguration),
10    application = this.application
11)
12
13// Get the AgentforceConversation
14val agentforceConversation =
15    agentforceClient.startAgentforceConversation(agentId)

To wire the permission manager in your app, add handlePermissionResult from AgentforceDefaultPermissions.

Handle Permission Results
1// In your activity, add handlePermissionResult
2// from AgentforceDefaultPermissions
3
4override fun onRequestPermissionsResult(
5    requestCode: Int,
6    permissions: Array<out String?>,
7    grantResults: IntArray,
8    deviceId: Int
9) {
10   super.onRequestPermissionsResult(
11       requestCode, permissions, grantResults, deviceId
12   )
13   AgentforceDefaultPermissions.handlePermissionResult(
14       requestCode, permissions, grantResults
15   )
16}

Create a Voice-Enabled Chat Container 

To create a chat container with voice enabled, pass agentforceConversation into the AgentforceConversationContainer.

Create Voice-Enabled Chat Container
1agentforceClient.AgentforceConversationContainer(agentforceConversation)