---
schema_version: "1"
id: c2759f385ea43581667445176ab831158266258a6213b96f8aa12c5165133a23
title: Android Quick Start Guide
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/genai/agentforce-mobile-sdk/guides/android/agentforce-mobile-sdk-android-quick-start.md
canonical_url: https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-android-quick-start.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: ecd30f31340ccd8187df8c743cc76c8273f311c77defd6f15c5539e2ce995360
products:
  - Agentforce Mobile SDK
  - Agentforce and Einstein Generative AI
---
# Android Quick Start Guide

Get up and running quickly with the Agentforce Mobile SDK for Android using these instructions.

## Before You Begin

Ensure you have:

- A Salesforce org with Agentforce enabled
- An agent configured in your org (Employee Agent or Service Agent)
- The required values from your Salesforce org depending on agent type

For detailed setup instructions, see [Before You Begin](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/agentforce-mobile-sdk-before-you-begin.md).

### For Service Agent

You need these values from your Salesforce org:

- **Service API URL**: Setup > Embedded Service Deployments > your deployment > Settings
- **Organization ID**: Setup > Company Information
- **ES Developer Name**: Setup > Embedded Service Deployments > Developer Name

### For Employee Agent

You need these values from your Salesforce org:

- **Agent ID**: From the Agent Details page URL (the 18-character ID at the end)
- **User ID**: From the user profile. See [Find the Salesforce ID for a User](https://help.salesforce.com/s/articleView?id=000381643&type=1).
- **Salesforce Domain**: Setup > My Domain > Current My Domain URL

## 1. Add Dependencies

Add the Agentforce SDK to your project.

```kotlin
// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
        maven { url = uri("https://opensource.salesforce.com/AgentforceMobileSDK-Android/agentforce-sdk-repository") }
        maven { url = uri("https://s3.amazonaws.com/inapp.salesforce.com/public/android") }
        maven { url = uri("https://s3.amazonaws.com/salesforce-async-messaging-experimental/public/android") }
    }
}

// build.gradle.kts
plugins {
   id("com.android.application")
   id("kotlin-android")
   id("kotlin-kapt")
   id("kotlinx-serialization")
   id("org.jetbrains.kotlin.plugin.compose")
}

// app/build.gradle.kts
android {
    compileOptions {
        isCoreLibraryDesugaringEnabled = true
    }
}

dependencies {
    // Agentforce SDK Dependencies
    api("com.salesforce.android.agentforcesdk:agentforce-sdk:14.97.1")

    coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5")
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
}
```

To learn more, see [Install the Android SDK](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-android-install.md).

## 2. Add Required Permissions

See [Android Requirements](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-android-requirements.md).

## 3. Implement Credential Provider

To use the SDK, be sure to import the Agentforce SDK packages.

```swift
import com.salesforce.android.agentforceservice.*
```

Create a credential provider using one of the supported authentication methods.

```kotlin
class MyAppCredentialProvider : AgentforceAuthCredentialProvider {
   override fun getAuthCredentials(): AgentforceAuthCredentials {
       return AgentforceAuthCredentials.OAuth(
           authToken = "YOUR_AUTH_TOKEN",
           orgId = "YOUR_ORG_ID",
           userId = "YOUR_USER_ID"
       )
   }
}
```

```kotlin
class MyAppCredentialProvider : AgentforceAuthCredentialProvider {
   override fun getAuthCredentials(): AgentforceAuthCredentials {
       return AgentforceAuthCredentials.OrgJWT(orgJWT = "YOUR_ORG_JWT")
   }
}
```

```kotlin
class MyAppCredentialProvider : AgentforceAuthCredentialProvider {
   override fun getAuthCredentials(): AgentforceAuthCredentials {
       return AgentforceAuthCredentials.Guest(url = "YOUR_GUEST_URL")
   }
}
```

To learn more, see [Integrate Agentforce SDK](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-android-integration.md).

## 4. Configure Chat

Configure your chat object for Employee agent or Service agent.

**tip:** For guidance on gathering information for the agent configuration object, see [Agent Type Setup](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/agentforce-mobile-sdk-before-you-begin.md#agent-type) in Before You Begin.

```kotlin
// Configure an Employee agent
val configuration = AgentforceConfiguration.builder(
    authCredentialProvider = myAuthCredentialProvider
)
    .setApplication(application)
    .setSalesforceDomain("https://your-domain.my.salesforce.com")
    .setAgentId("YOUR_AGENT_ID")
    .setThemeManager(createCustomAgentforceThemeManager(themeMode = AgentforceThemeMode.SYSTEM))
    .setNetwork(myNetworkProvider)
    .setLogger(myLogger)
    .setNavigation(myNavigation)
    .build()

// Set mode for Employee agent
val agentforceMode = AgentforceMode.FullConfig(configuration)

// Create client
agentforceClient?.init(
    authCredentialProvider = configuration.authCredentialProvider,
    agentforceMode = agentforceMode,
    application = application
)
```

```kotlin
// Configure a Service agent
val serviceAgentConfig = ServiceAgentConfiguration.builder(
    serviceApiURL = "https://your-service-api-url.com",
    organizationId = "YOUR_ORG_ID",
    esDeveloperName = "YOUR_CHAT_DEVELOPER_NAME",
    authorizationContext = AuthorizationContext(
        authorizationMethod = AuthorizationMethod.UNVERIFIED
    )
).build()

val agentforceMode = AgentforceMode.ServiceAgent(
    serviceAgentConfiguration = serviceAgentConfig,
    agentforceConfiguration = configuration
)

// Create client
agentforceClient?.init(
    authCredentialProvider = configuration.authCredentialProvider,
    agentforceMode = agentforceMode,
    application = application
)
```

To learn more, see [Integrate Agentforce SDK](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-android-integration.md).

## 5. Start and Present Chat

Start the chat conversation.

```kotlin
// Start conversation
val conversation = agentforceClient.startAgentforceConversation()
```

And add the UI component.

```kotlin
@Composable
fun MyChatScreen(
    agentforceClient: AgentforceClient,
    conversation: AgentforceConversation,
    onClose: () -> Unit
) {
    agentforceClient.AgentforceConversationContainer(
        conversation = conversation,
        onClose = onClose
    )
}
```

To learn more, see [Integrate Agentforce SDK](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-android-integration.md).

## Next Steps

- **Customization**: See [Branding and Theming](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-android-branding-theming.md) for visual customization
- **Full Integration**: See [Integration Guide](https://developer.salesforce.com/docs/ai/agentforce-mobile-sdk/guide/agentforce-mobile-sdk-android-integration-overview.md) for complete implementation
