Articles in this section
Category / Section

How to Configure and Integrate SDK in Your Android app

Updated:

Integrating the BoldDesk Chat SDK into your Android application enables you to provide a seamless and engaging chat experience for your users. With this SDK, customers can connect with support agents in real time, ensuring faster responses and improved satisfaction.

This guide offers clear, step-by-step instructions to configure and integrate the BoldDesk Chat SDK into your Android application, including installation and push notification setup. By completing this integration, you’ll enable your users to:

  • Engage in real-time conversations with your support agents.
  • Share files, screenshots, or documents directly within the chat for faster issue resolution.
  • Enjoy a fully branded, customizable chat interface that aligns with your app’s design.
  • Receive instant notifications for new chat messages, ensuring they never miss an update.

Whether you’re launching a new app or enhancing an existing one, the BoldDesk Chat SDK ensures a seamless, professional support experience—right inside your mobile application.

SDK Installation

Add Maven Repository

In your project-level settings.gradle:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
    }
}

Add Dependency

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" />

Initialization and Authentication

Initialize 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")

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)

User Profile Configuration

Use these methods to associate user details with the chat session, ensuring proper identification, personalization, and secure authentication.

// Set the user’s email address for chat initiation
BoldDeskChatSDK.setUserEmail("user@example.com") 

// Define the display name shown to agents during chat interactions
BoldDeskChatSDK.setUserName("John Doe") 

// Add the user’s phone number for follow-ups or verification
BoldDeskChatSDK.setUserPhoneNo("1234567890") 

// Configure a secure token to authenticate the user session 
BoldDeskChatSDK.setUserToken("your_token_here")

Clear Session

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

BoldDeskChatSDK.clearSession()

UI Customization

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,
            )

Fallback

If no custom font is set, the SDK will use your app theme’s default typeface.

Push Notification Integration

The SDK supports push notifications using Firebase Cloud Messaging (FCM) to alert users about chat incoming 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")

Initialize 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”) 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

Limitation

Single SDK Instance:

Only one instance of the Chat SDK can run at a time. Initializing multiple instances simultaneously is not supported and may lead to unexpected behavior.

Language Support:

The current version of the SDK supports only the en-US language. Additional language support will be added in future releases.

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.

Frequently Asked Questions (FAQ)

Q1: What is the BoldDesk Chat SDK for Android?
BoldDesk Chat SDK, enabling seamless integration of live chat widget functionality into your applications. With this SDK, you can embed BoldDesk’s chat widget features across platforms, delivering a smooth, customizable, and engaging customer support experience.

Q2: How do I install the SDK in my Android project?
You need to:

  • Add the Maven repository in your settings.gradle.
  • Add the SDK dependency in your app-level build.gradle:
    implementation ‘com.bolddesk:bolddesk_chat_sdk:{latestversion}’
    chat

Q3: What permissions are required in AndroidManifest.xml?
Add the following permissions:

  • INTERNET and ACCESS_NETWORK_STATE for network access.
  • READ_EXTERNAL_STORAGE for uploading/downloading attachments.
  • POST_NOTIFICATIONS for receiving push notifications.

Q4: How do I initialize the SDK?
Call:

BoldDeskChatSDK.configure(context, "Your AppID", "Your brand URL")

Q5: How do I enable push notifications?
Integrate Firebase Cloud Messaging (FCM):

  • Add Firebase dependencies.
  • Register your app in Firebase Console.
  • Forward the FCM token to SDK using:
BoldDeskChatSDK.enablePushNotification(token)

Handle notifications in onMessageReceived using BoldDeskChatSDK.handlePushNotifications().

Q6: How do I clear current conversation in the SDK?

  • To clear the current conversation data in the chat SDK.
BoldDeskChatSDK.clearSession()

Q7: Does the SDK support multiple instances or languages?

  • Multiple instances: No, only one SDK instance can run at a time.
  • Languages: Currently supports only en-US. More languages will be added in future releases.
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied