{"id":25138458,"url":"https://github.com/carrotquest/android-sdk","last_synced_at":"2025-12-26T11:19:31.604Z","repository":{"id":41295317,"uuid":"154781617","full_name":"carrotquest/android-sdk","owner":"carrotquest","description":"Conversational platform for business. Android sdk.","archived":false,"fork":false,"pushed_at":"2025-04-18T08:22:55.000Z","size":171117,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"dashly","last_synced_at":"2025-04-24T03:08:07.087Z","etag":null,"topics":["android","chatbot","conversion-rate-optimization","customer-engagement","customer-service","inbox","integration","lead-generation","livechat","mobile-app-updates","settings","triggered-messages"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carrotquest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-26T05:25:43.000Z","updated_at":"2025-04-18T08:00:32.000Z","dependencies_parsed_at":"2023-01-21T10:03:49.315Z","dependency_job_id":"c9cfa65e-7bb3-4083-98ce-8267ff59fbda","html_url":"https://github.com/carrotquest/android-sdk","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carrotquest%2Fandroid-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carrotquest%2Fandroid-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carrotquest%2Fandroid-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carrotquest%2Fandroid-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carrotquest","download_url":"https://codeload.github.com/carrotquest/android-sdk/tar.gz/refs/heads/dashly","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250552074,"owners_count":21449164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","chatbot","conversion-rate-optimization","customer-engagement","customer-service","inbox","integration","lead-generation","livechat","mobile-app-updates","settings","triggered-messages"],"created_at":"2025-02-08T17:16:39.307Z","updated_at":"2025-12-26T11:19:31.597Z","avatar_url":"https://github.com/carrotquest.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Table of Contents\n\n* [Dashly for Android](#dashly-for-android)\n* [Installation](#installation)\n* [Upgrade to Version 2.0.0](#upgrade)\n* [Initialization](#initialization)\n* [User Authentication](#user-authentication)\n* [User Properties and Events](#user-properties-and-events)\n* [Chat with Operator](#chat-with-operator)\n  * [Floating Button](#floating-button)\n  * [Opening Chat from Any Location](#opening-chat-from-any-location)\n* [Notifications](#notifications)\n  * [Firebase Cloud Messaging Setup](#firebase-cloud-messaging-setup)\n  * [Huawei Push Kit Setup](#huawei-push-kit-setup)\n  * [General Notification Settings](#general-notification-settings)\n\n\n## Dashly for Android\n\nDashly for Android supports API 19 and above.\n\n## Installation\nCurrently, Dashly for Android can be installed using gradle. \nTo do this, add the repository to the project `build.gradle` file:\n```groovy\nallprojects {\n    ...\n    repositories {\n        ...\n        maven { url \"https://raw.github.com/carrotquest/android-sdk/dashly\" }\n        maven { url \"https://jitpack.io\" }\n    }\n}\n```\nSpecify the dependencies in your application's `build.gradle` file:\n```groovy\nandroid {\n    ...\n    defaultConfig {\n        ...\n        multiDexEnabled true\n    }\n    packagingOptions {\n        exclude 'META-INF/*.kotlin_module'\n    }\n}\n\ndependencies {\n    ...\n    implementation 'com.android.support:multidex:1.0.3'\n    implementation 'io.carrotquest:android-sdk:2.0.1-usRelease'\n}\n```\n\nThe library uses Java 17. If your project uses a Java version below 17, add the following settings:\n```groovy\nandroid {\n    ...\n    compileOptions {\n        sourceCompatibility '17'\n        targetCompatibility '17'\n    }\n}\n```\n\n## Upgrade\nNote that when transitioning to version 2.0.0, some important changes were made to the way you interact with the library.\n\nTo unify the code with the iOS SDK, one parameter - appId - was removed from the library's initialization method. Now, the best way to initialize the library looks like this:\n```kotlin\nDashly.setup(this, yourApiKey, object : Dashly.Callback\u003cBoolean\u003e {\n    override fun onResponse(result: Boolean) {\n        \n    }\n\n    override fun onFailure(t: Throwable) {\n\n    }\n})\n```\n\nIf you have user authentication, make sure to call it at the start of the application. The best place for this is in the onResponse callback of the setup method:\n```kotlin\nDashly.setup(this, yourApiKey, object : Dashly.Callback\u003cBoolean\u003e {\n    override fun onResponse(result: Boolean) {\n        if(result) {\n            Dashly.auth(userId, userAuthKey, object : Dashly.Callback\u003cString\u003e {\n                override fun onResponse(result: String?) {\n                    \n                }\n\n                override fun onFailure(t: Throwable) {\n                    \n                }\n            })\n        }\n    }\n\n    override fun onFailure(t: Throwable) {\n\n    }\n})\n```\nThis will prevent unnecessary anonymous user occurrences.\n\n## Initialization\nTo use Dashly for Android, you need the API Key and User Auth Key. You can find these keys in the Settings \u003e Developers tab:\n![Api keys](https://github.com/carrotquest/android-sdk/blob/dashly/img/dashly_api_keys.png?raw=true)\n\nTo initialize Dashly, you need to execute the following code in your application's onCreate() method:\n\n```kotlin\nDashly.setup(this, apiKey, callback)\n```\n\nTo display additional information during debugging, use the method:\n```kotlin\nDashly.setDebug(true)\n```\n\n## User Authentication\n\nIf your application includes user authentication, you can pass the user id to Dashly. There are two ways to authenticate: directly pass the userAuthKey, or send a hash generated on your backend. Upon successful login, the dashly_id property value is returned in the callback.\n\n1. Login via user auth key:\n\n```kotlin\nDashly.auth(userId, userAuthKey, callback)\n```\n\n2. Login via hash:\n\n```kotlin\nDashly.hashedAuth(userId, hash, callback)\n```\n\nTo change the user, you need to first call the deinitialization method, and then re-call the initialization and (optionally) authentication methods:\n```kotlin\nDashly.deInit(object : Dashly.Callback\u003cBoolean\u003e {\n    override fun onResponse(result: Boolean) {\n        Dashly.setup(this, yourApiKey, callbackSetup)\n    }\n\n    override fun onFailure(t: Throwable) {\n        \n    }\n})\n```\n\n## User Properties and Events\n\nYou can set user properties using:\n```kotlin\nDashly.setUserProperty(userProperty)\nDashly.setUserProperty(userPropertyList)\n```\n\nTo describe user properties, use the `UserProperty` class:\n```java\npublic UserProperty(String key, String value)\npublic UserProperty(Operation operation, String key, String value)\n```\nFor more details on `Operations`, please refer to the [«User Properties»](https://developers.dashly.io/props/#_3) section.\n\n`Attention!`\n\nThe `key` field cannot start with the `$` symbol.\n\nFor setting [system properties](https://developers.dashly.io/props#_4), two classes `CarrotUserProperty` and `EcommerceUserProperty` are implemented.\n\nTo track events, use:\n```kotlin\nDashly.trackEvent(eventName)\n```\n\nYou can specify additional parameters for an event in JSON format and pass them to the method:\n```kotlin\nDashly.trackEvent(eventName, eventParams)\n```\n\nThe SDK offers the ability to track navigation within the application to launch various trigger messages on specific screens if needed. Use the following method for this:\n```kotlin\nDashly.trackScreen(screenName)\n```\n\nYou can retrieve a list of identifiers for unread conversations at the moment:\n```kotlin\nDashly.getUnreadConversations()\n```\n\nYou can also subscribe to changes in the list of unread conversation identifiers:\n```kotlin\nDashly.setUnreadConversationsCallback(callback)\n```\n\n## Chat with Operator\n\nYou can give the mobile app user the ability to access the chat with an operator from anywhere. This can be accomplished in two ways—using a floating button or directly calling the chat opening method at any desired time.\n\n### Floating Button\n\nEssentially, this is a user interface element inheriting from `ConstraintLayout`. You can embed it into your layout:\n```xml\n\u003cio.carrotquest_sdk.android.ui.fab.FloatingButton\n    android:id=\"@+id/cq_sdk_float_button\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    app:cq_location_fab=\"BOTTOM_RIGHT\"\n    app:cq_visibility_background=\"false\"\n    app:cq_icon_fab=\"@drawable/ic_send\"\n    app:cq_margin_fab=\"8dp\"\n    app:cq_show_social_labels=\"false\"\n    app:cq_auto_hide_fab=\"true\"\n/\u003e\n```\n\nThis element has its own attributes:\n- `app:cq_location_fab` dictates the placement of the floating button relative to its parent container. There are 4 possible positions: `TOP_LEFT`, `TOP_RIGHT`, `BOTTOM_LEFT`, `BOTTOM_RIGHT`; default is `BOTTOM_RIGHT`.\n- `app:cq_visibility_background` controls the visibility of the dimming effect when the floating button is pressed. Default is `true`.\n- `app:cq_icon_fab` sets the icon for the floating button. Default is `@id/ic_cq_message`.\n- `app:cq_margin_fab` specifies the margins of the floating button relative to its parent container. Default is `16dp`.\n- `app:cq_show_social_labels` manages the visibility of labels next to social media icons. Default is `true`.\n- `app:cq_auto_hide_fab` determines automatic hiding of the chat button when the internet is unavailable. Default is `false`.\n\n#### Floating Button Interface\n\nAvailable methods for configuring and managing the floating button's behavior:\n\n```java\n/**\n * Show the floating button\n */\npublic void showFab()\n```\n\n```java\n/**\n * Hide the floating button\n */\npublic void hideFab()\n```\n\n```java\n/**\n * Show integration buttons\n */\npublic void expandMenu()\n```\n\n```java\n/**\n * Hide integration buttons\n */\npublic void collapseMenu()\n```\n\n```java\n/**\n * Set chat icon\n * @param iconFAB Icon\n */\npublic void setIconFAB(Drawable iconFAB)\n```\n\n```java\n/**\n * Set button margins from screen edges\n * @param margin Margin value\n */\npublic void setMarginFAB(int margin)\n```\n\n```java\n/**\n * Set button location\n * @param location Button location\n */\npublic void setLocationFAB(LocationFAB location)\n```\n\n### Opening Chat from Any Location\n\nYou can also open the chat by executing the following code from any location (post initialization):\n```kotlin\nDashly.openChat(context)\n```\n\n# Notifications\n\nThe SDK supports two push notification providers - Firebase Cloud Messaging and Huawei Push Kit.\n\n## Firebase Cloud Messaging Setup\n\nFirst, you need to obtain a key and send it to Dashly. You can find the field for entering the key in Settings \u003e Developers \u003e Push notifications for SDK. The setup process for Firebase Cloud Messaging is described here.\n\nIf you are already using Firebase Cloud Messaging for your push notifications, to ensure that push notifications work correctly in the SDK, you need to edit your FirebaseMessagingService. This is necessary to pass the token and our messages into the SDK. Example:\n\n```kotlin\nclass MyFirebaseMessagingService : FirebaseMessagingService() {\n    override fun onMessageReceived(message: RemoteMessage) {\n        val pushData: Map\u003cString, String\u003e = message.data\n\n        if (Dashly.isDashlyPush(pushData)) {\n            Dashly.sendPushNotification(pushData, this)\n        } else {\n            // Your code\n        }\n    }\n\n    override fun onNewToken(token: String) {\n        Dashly.sendToken(token)\n        super.onNewToken(token)\n    }\n}\n```\n\n## Huawei Push Kit Setup\n\nTo deliver notifications to users with devices without Google services, you can use Huawei's push notification delivery service. First, you need to integrate HPK into your application. Instructions can be found here. Then, in Settings \u003e Developers \u003e Push notifications for SDK, you need to provide the Client ID, Client Secret, and Webhook Secret. Next, modify the service inherited from HmsMessageService. Example:\n\n```kotlin\nclass MyHuaweiPushKitService : HmsMessageService() {\n    override fun onMessageReceived(remoteMessage: RemoteMessage?) {\n        val pushData: Map\u003cString, String\u003e = remoteMessage?.dataOfMap ?: HashMap()\n        if (Dashly.isDashlyPush(pushData)) {\n            Dashly.sendPushNotification(pushData, this)\n        } else {\n            // Your code\n        }\n    }\n\n    override fun onNewToken(token: String?) {\n        Dashly.sendToken(token)\n        super.onNewToken(token)\n    }\n\n    override fun onNewToken(token: String?, p1: Bundle?) {\n        Dashly.sendToken(token)\n        super.onNewToken(token, p1)\n    }\n}\n```\n\n## General Notification Settings\n\nYou can change the icon and color of notifications for new messages. To set the icon for notifications, call the following method after initializing the SDK:\n\n```kotlin\nDashly.setNotificationIcon(R.drawable.ic_notification_icon)\n```\n\nAlternatively, add an icon named `ic_cq_notification.xml` in the `res/drawable` directory. To set the notification color, specify a color named `colorCqNotify` with your desired value in the resource file:\n\n```xml\n\u003ccolor name=\"colorCqNotify\"\u003e#EF7F28\u003c/color\u003e\n```\n\nIf you want to receive information about new messages in the SDK from anywhere in your application, you can implement a `BroadcastReceiver`. Example implementation:\n\n```java\npublic class MyNewMessageBroadcastReceiver extends BroadcastReceiver {\n    @Override\n    public void onReceive(Context context, Intent intent) {\n        if(intent.hasExtra(NotificationsConstants.CQ_SDK_NEW_MESSAGE_ARG)) {\n            IncomingMessage incomingMessage = (IncomingMessage) intent.getSerializableExtra(NotificationsConstants.CQ_SDK_NEW_MESSAGE_ARG);\n            if (incomingMessage != null) {\n                Toast.makeText(context, incomingMessage.getText(), Toast.LENGTH_SHORT).show();\n            }\n        }\n    }\n}\n```\n`IncomingMessage` is a class that describes the incoming message.\n\nNext, you need to register it:\n\n```java\nMyNewMessageBroadcastReceiver messageReceiver = new MyNewMessageBroadcastReceiver();\nIntentFilter filter = new IntentFilter();\nfilter.addAction(NotificationsConstants.CQ_SDK_NEW_MESSAGE_ACTION);\nregisterReceiver(messageReceiver, filter);\n```\n\nImportant! If the application is closed and the user opens the chat by clicking a push, your start activity will not launch. The application will close along with the closure of the chat. To fix this, you can pass the full name of the activity that should launch when the chat is closed:\n\n```java\nDashly.setParentActivityClassName(\"io.test.MainActivity\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarrotquest%2Fandroid-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarrotquest%2Fandroid-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarrotquest%2Fandroid-sdk/lists"}