Install the package

In your app-level build.gradle:

dependencies {
    implementation("com.bolddesk:bolddesk_chat_sdk:{latest-version}")
}

You can find the latest package version here Android Package

Required Permissions

Add the following to your AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- To download or upload attachment via SDK -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <!-- To receive push notification in your app -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera.any" />

<!-- Required to open camera and securely capture image via SDK -->
<provider
     android:name="androidx.core.content.FileProvider"
     android:authorities="${applicationId}.fileprovider"
     android:exported="false"
     android:grantUriPermissions="true">
     <meta-data
         android:name="android.support.FILE_PROVIDER_PATHS"
         android:resource="@xml/file_paths" />
     </provider>
 
<!-- Define cache directories path for camera image storage -->
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <cache-path name="images" path="." />
</paths>

SDK Initialization

Configure SDK

Initialize once in your Application class or before using SDK features.

import com.syncfusion.bolddeskandroidchatSDK.BoldDeskChatSDK

BoldDeskChatSDK.configure(context = context, "Your AppKey", "Your brand URL", culture = "en-US")

Show Chat

Launches the BoldDesk chat interface inside your app, allowing users to start or continue conversations with support agents.

BoldDeskChatSDK.showChat(context)

Close Chat

Closes the active chat window and returns the user to the app interface.

BoldDeskChatSDK.closeChat(context)

Prefilling User Fields

You can pre-fill user details before initializing the chat. This improves the user experience by eliminating the need for manual entry.

Property Description
Email Pre-fills the user’s email. If provided, visitors don’t need to enter it manually. The conversation is created using this email once the visitor sends their first message.
Name Pre-fills the user’s name. Requires an email to be set.
Phone Number Pre-fills the user’s phone number. Requires an email to be set.
Chat Fields The fields configuration block allows you to prefill Custom Chat Fields using their Field API Names.
BoldDeskChatSDK.setPrefillFields(
         name = "John Do",
         email = "user@example.com",
         phoneNumber = "1234567890",
         chatFields = mapOf("categoryId" to "12","cf_country" to "21"),
        )

User Verification with JWT

Live Chat enables user verification using JSON Web Tokens (JWT). Through JWT-based verification, users are identified as either verified or not verified within the configured live chat. To learn more, see How to Verify Users Conversation In Live Chat.

BoldDeskChatSDK.setUserToken("your_token_here")

Clear Session

Resets the current chat session, removing user-specific data and cached information.

BoldDeskChatSDK.clearSession()

UI Customization

Apply Theme

You can dynamically apply themes for appbar and buttons

BoldDeskChatSDK.applyTheme(
    appBarColor = "#1976D2",     
    accentColor = "#FFC107",
    backgroundColor = "#1976D2", 
    stickyButtonColor = "#FFC107" 
)

Theme Modes

Mode Description Code snippet
Light Forces light mode BoldDeskChatSDK.setPreferredTheme(BoldDeskChatSDK.SDKTheme.LIGHT)
Dark Forces dark mode BoldDeskChatSDK.setPreferredTheme(BoldDeskChatSDK.SDKTheme.DARK)
System Default Follow system theme BoldDeskChatSDK.setPreferredTheme(BoldDeskChatSDK.SDKTheme.SYSTEM)

Font Customization

The SDK supports custom fonts defined in your main application.

Include Font Files

Add your custom fonts under:
- app/src/main/res/font/

Example:
- res/font/font.inter_regular.ttf
- res/font/font.inter_medium.ttf
- res/font/font.inter_bold.ttf

Register Fonts in Code

BoldDeskChatSDK.applyCustomFontFamily(
                regular = R.font.inter_regular,
                bold = R.font.inter_bold,
                semiBold = R.font.inter_semibold,
                medium = R.font.inter_medium,
            )

Push Notification Integration

The SDK supports push notifications using Firebase Cloud Messaging (FCM) to alert users about incoming chat messages.

Add Firebase to Your Project

  • Go to Firebase Console Add Firebase to your Android project
  • Add a new Android app and register it with your Bundle Identifier
  • Download the generated GoogleService.plist file
  • Add the file to your project
  • Add Firebase dependencies in your build.gradle
implementation(platform("com.google.firebase:firebase-bom:34.3.0"))
implementation("com.google.firebase:firebase-messaging:25.0.1")

Register Firebase

In your AndroidManifest.xml, add your FCM service:

<service
         android:name=".NotificationService"
          android:exported="false">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
    </service>

Forward Token to SDK

class MyFirebaseService : FirebaseMessagingService() {
    override fun onNewToken(token: String) {
        super.onNewToken(token)
        BoldDeskChatSDK.enablePushNotification(context, token)
    }
}

Handling push notifications

To handle push notifications, include the following snippets in the onMessageReceived of FirebaseMessagingService class

override fun onMessageReceived(remoteMessage: RemoteMessage) {
    if (BoldDeskChatSDK.isFromChatSDK(context, remoteMessage.getData())) {
       BoldDeskChatSDK.handlePushNotifications(context, remoteMessage.getData(), icon = "Your app icon")
   }

Error Logging

Enable debug logging during development to view detailed SDK logs in Logcat.

BoldDeskChatSDK.enableLogging()

API Reference

API Description
BoldDeskChatSDK.configure(context, “Your AppKey”, “Your brand URL”, “en-US”) Initializes the SDK
BoldDeskChatSDK.showChat(context) To open chat widget window
BoldDeskChatSDK.closeChat(context) To close chat widget window
BoldDeskChatSDK.clearSession() To clear current conversation data
BoldDeskChatSDK.setPreferredTheme(mode) Sets light/dark/system theme
BoldDeskChatSDK.applyCustomFontFamily(…) Apply custom font to match your app
BoldDeskChatSDK.enablePushNotification(token) To send registered device token to SDK app for receiving push notifications
BoldDeskChatSDK.disablePushNotification(token) Stop receiving push notifications

Sample App

A sample application is provided along with the SDK package to help you understand the integration flow and available features.
You can use this app to explore the SDK behavior before integrating it into your own project Android SDK Sample.