Stay organized with collections
Save and categorize content based on your preferences.
You can set up mobile apps to work with Contact Center AI Platform (CCAI Platform) in a number of
ways, including with Flutter. This page shows you how to integrate the Android
SDK into an Android app using Flutter.
Before you begin
Before following the instructions on this page, you must first follow the
instruction in Integrate using Flutter.
Integrate the SDK into an Android app
To integrate the SDK into an Android app, follow these steps:
In the android/build.gradle file in your Flutter example directory, update
minSdkVersion to 21 or later.
In the android/src/main/AndroidManifest.xml file, add the following:
Create a Firebase project or, if you already have one, register this app.
Download the google-service.json file and put it in your project in the
following directory: example/android/app/.
Register the module
To register the module, open MainActivity.kt and initialize UJETModule, as
in the following code sample:
Follow these steps if you want to integrate push notifications natively. Be sure
that you have copied and pasted the firebase directory into your android project
as directed in Integrate the SDK into an Android
app.
To set up Android push notifications, follow these steps:
Add a firebase dependency for push notifications in your app-level
build.gradle file, as in the following code sample:
Create MyFirebaseMessagingService that implements
FirebaseMessagingService, as in the following code sample:
classMyFirebaseMessagingService:FirebaseMessagingService(){privatevarfirebaseTokenManager:FirebaseTokenManager?=null
overridefunonCreate(){super.onCreate()firebaseTokenManager=FirebaseTokenManager(this)}overridefunonNewToken(token:String){firebaseTokenManager?.updateToken(token)}overridefunonMessageReceived(message:RemoteMessage){if(Ujet.canHandlePush(message.data)){Log.d("Firebase","Handle the push message by UJET")}else{//Handleyournotifications
}}}
Create FirebaseTokenManager, as in the following code sample:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[[["\u003cp\u003eThis guide explains how to integrate the Android SDK for Contact Center AI Platform (CCAI Platform) into an Android app using Flutter.\u003c/p\u003e\n"],["\u003cp\u003eBefore starting the integration, you must first follow the instructions outlined in the "Integrate using Flutter" document.\u003c/p\u003e\n"],["\u003cp\u003eIntegrating the SDK involves updating various files, including \u003ccode\u003ebuild.gradle\u003c/code\u003e, \u003ccode\u003eAndroidManifest.xml\u003c/code\u003e, and \u003ccode\u003estrings.xml\u003c/code\u003e, and adding specific code snippets and dependencies.\u003c/p\u003e\n"],["\u003cp\u003eSetting up Android push notifications requires adding Firebase dependencies, updating \u003ccode\u003eAndroidManifest.xml\u003c/code\u003e, creating \u003ccode\u003eMyFirebaseMessagingService\u003c/code\u003e, and \u003ccode\u003eFirebaseTokenManager\u003c/code\u003e, and using the \u003ccode\u003egoogle-services\u003c/code\u003e plugin.\u003c/p\u003e\n"],["\u003cp\u003eTo register the module, initialize \u003ccode\u003eUJETModule\u003c/code\u003e in the \u003ccode\u003eMainActivity.kt\u003c/code\u003e file by registering it and initialising it with the flutter engine.\u003c/p\u003e\n"]]],[],null,["# Flutter for Android\n\nYou can set up mobile apps to work with Contact Center AI Platform (CCAI Platform) in a number of\nways, including with Flutter. This page shows you how to integrate the Android\nSDK into an Android app using Flutter.\n\nBefore you begin\n----------------\n\nBefore following the instructions on this page, you must first follow the\ninstruction in [Integrate using Flutter](/contact-center/ccai-platform/docs/mobileSDK-overview#integrate-using-flutter).\n\nIntegrate the SDK into an Android app\n-------------------------------------\n\nTo integrate the SDK into an Android app, follow these steps:\n\n1. In the `android/build.gradle` file in your Flutter example directory, update\n `minSdkVersion` to 21 or later.\n\n2. In the `android/src/main/AndroidManifest.xml` file, add the following:\n\n \u003capplication\u003e\n \u003cactivity\n android:name=\"co.ujet.android.activity.UjetActivity\"\n android:exported=\"true\"\u003e\n \u003cintent-filter\u003e\n \u003caction android:name=\"android.intent.action.VIEW\"/\u003e\n \u003ccategory android:name=\"android.intent.category.DEFAULT\"/\u003e\n \u003ccategory android:name=\"android.intent.category.BROWSABLE\"/\u003e\n \u003c!-- TODO: Change to your custom URL scheme. Config from Portal \u003e Developer Settings \u003e Mobile App \u003e Enable Send SMS to Download App \u003e Android App \u003e URL --\u003e\n \u003cdata\n android:host=\"co.ujet.flutter_example_app\"\n android:path=\"/smartchannel\"\n android:scheme=\"ujet\" /\u003e\n \u003c/intent-filter\u003e\n \u003c/activity\u003e\n\n \u003cmeta-data\n android:name=\"co.ujet.android.companyKey\"\n android:value=\"@string/ujet_company_key\"/\u003e\n \u003cmeta-data\n android:name=\"co.ujet.android.companyName\"\n android:value=\"@string/ujet_company_name\"/\u003e\n \u003cmeta-data\n android:name=\"co.ujet.android.subdomain\"\n android:value=\"@string/ujet_subdomain\"/\u003e\n \u003cmeta-data\n android:name=\"co.ujet.android.companyUrl\"\n android:value=\"@string/ujet_company_url\"/\u003e\n \u003c/application\u003e\n\n3. In the `\u003capplication\u003e` tag, update the `android:name` value to\n `.Application`, as in the following code sample:\n\n \u003c!--Change the value of android:name to .Application --\u003e\n \u003capplication\n android:name=\".Application\"\n android:label=\"Demo Application\"\n android:icon=\"@mipmap/ic_launcher\"\u003e\n\n4. Update `android/build.gradle`, as in the following code sample:\n\n allprojects {\n repositories {\n google()\n mavenCentral()\n maven {\n url \"https://sdk.ujet.co/android/\"\n }\n }\n }\n\n5. Update `android/app/build.gradle`, as in the following code sample:\n\n dependencies {\n // Use UJET SDK version 2.6.0 or latest to support recent push notification changes.\n def ujetSdkVersion = \"x.y.z\"\n implementation \"co.ujet.android:ujet-android:$ujetSdkVersion\"\n implementation \"co.ujet.android:cobrowse:$ujetSdkVersion\"\n }\n\n6. Update `res/values/strings.xml`, as in the following code sample. Create this if\n it doesn't exist.\n\n \u003cresources\u003e\n \u003cstring name=\"ujet_company_key\"\u003eYOUR_COMPANY_KEY\u003c/string\u003e\n \u003cstring name=\"ujet_company_name\"\u003eYOUR_COMPANY_NAME\u003c/string\u003e\n\n \u003c!-- If your tenant / portal url ends with \"ujet.co\" then set ujet_subdomain string only (ignore\n ujet_company_url), otherwise set ujet_company_url only (ignore ujet_subdomain) following below instructions. --\u003e\n \u003c!-- To get subdomain, extract string content between 'https://' and first '.' of your tenant/portal URL.\n Example, If your tenant url is https://XXX.YYY.ZZZ/ then subdomain will be XXX --\u003e\n \u003cstring name=\"ujet_subdomain\"\u003eYOUR_SUBDOMAIN\u003c/string\u003e\n\n \u003c!-- Use tenant url as company url here, it should be in format of https://XXX.YYY.ZZZ/api/v2\n (here XXX should match with your subdomain) --\u003e\n \u003cstring name=\"ujet_company_url\"\u003eYOUR_COMPANY_URL\u003c/string\u003e\n \u003c/resources\u003e\n\n7. Create a Firebase project or, if you already have one, register this app.\n Download the `google-service.json` file and put it in your project in the\n following directory: `example/android/app/`.\n\nRegister the module\n-------------------\n\nTo register the module, open `MainActivity.kt` and initialize `UJETModule`, as\nin the following code sample: \n\n class MainActivity : FlutterActivity() {\n override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {\n super.configureFlutterEngine(flutterEngine)\n\n //Register and Initialize UJETModule\n UJETModule.init(flutterEngine.dartExecutor.binaryMessenger, applicationContext)\n }\n }\n\nSet up Android push notifications\n---------------------------------\n\nFollow these steps if you want to integrate push notifications natively. Be sure\nthat you have copied and pasted the firebase directory into your android project\nas directed in [Integrate the SDK into an Android\napp](#integrate-the-sdk-into-an-android-app).\n\nTo set up Android push notifications, follow these steps:\n\n1. Add a firebase dependency for push notifications in your app-level\n `build.gradle` file, as in the following code sample:\n\n dependencies {\n implementation platform(\"com.google.firebase:firebase-bom:32.8.0\")\n implementation 'com.google.firebase:firebase-messaging'\n }\n\n2. Update `AndroidManifest.xml`, as in the following code sample:\n\n \u003capplication\u003e\n \u003cservice\n android:name=\".firebase.MyFirebaseMessagingService\"\n android:exported=\"false\"\u003e\n \u003cintent-filter\u003e\n \u003caction android:name=\"com.google.firebase.MESSAGING_EVENT\" /\u003e\n \u003c/intent-filter\u003e\n \u003c/service\u003e\n \u003c/application\u003e\n\n3. Add a google-services plugin at the root level of your project in\n `build.gradle`, as in the following code sample:\n\n plugins {\n id 'com.google.gms.google-services' version '4.3.8' apply false\n }\n\n4. Add a google-services plugin at the app level of your project in\n `build.gradle`, as in the following code sample:\n\n plugins {\n id \"com.android.application\"\n id \"kotlin-android\"\n id \"dev.flutter.flutter-gradle-plugin\"\n id 'com.google.gms.google-services' // google-services plugin\n }\n\n5. Create `MyFirebaseMessagingService` that implements\n `FirebaseMessagingService`, as in the following code sample:\n\n class MyFirebaseMessagingService: FirebaseMessagingService() {\n private var firebaseTokenManager: FirebaseTokenManager? = null\n\n override fun onCreate() {\n super.onCreate()\n firebaseTokenManager = FirebaseTokenManager(this)\n }\n\n override fun onNewToken(token: String) {\n firebaseTokenManager?.updateToken(token)\n }\n\n override fun onMessageReceived(message: RemoteMessage) {\n if (Ujet.canHandlePush(message.data)) {\n Log.d(\"Firebase\", \"Handle the push message by UJET\")\n } else {\n // Handle your notifications\n }\n }\n }\n\n6. Create `FirebaseTokenManager`, as in the following code sample:\n\n class FirebaseTokenManager(context: Context) {\n private val sharedPreferences = context.getSharedPreferences(\"${context.packageName}_preferences\", Context.MODE_PRIVATE)\n private var token: String? = null\n\n fun getToken(): String? {\n token = sharedPreferences.getString(\"firebaseToken\", null)\n if (token == null) {\n FirebaseMessaging.getInstance().token.addOnCompleteListener { task: Task\u003cString?\u003e -\u003e\n if (!task.isSuccessful || task.result == null) {\n return@addOnCompleteListener\n }\n token = task.result\n updateToken(token)\n }\n }\n return token\n }\n\n fun updateToken(token: String?) {\n sharedPreferences\n .edit()\n .putString(\"firebaseToken\", token)\n .apply()\n }\n }"]]