Desk360 Docs
Search…
Mobile Android SDK
Desk360 Mobile Android SDK helps you embed customer support in your Android applications with ease.

Features

The Desk360 Mobile SDK for Android lets customers do any of the following:‌
    Create new support tickets
    View and comment on existing tickets
    Interactively communicate with related support teams.
The latest version of Mobile Android SDK is 1.0.3.

Installation

Gradle

To integrate Desk360 into your Android project, add the code below to your project level build.gradlle
1
allprojects {
2
repositories {
3
...
4
maven { url 'https://jitpack.io' }
5
}
6
}
Copied!
Add the dependency
1
dependencies {
2
implementation 'com.github.Teknasyon-Teknoloji:desk360-android-sdk:1.0.1'
3
}
Copied!
Or Maven
Step 1. Add the JitPack repository to your build file
1
<repositories>
2
<repository>
3
<id>jitpack.io</id>
4
<url>https://jitpack.io</url>
5
</repository>
6
</repositories>
Copied!
Step 2. Add the dependency
1
<dependency>
2
<groupId>com.github.Teknasyon-Teknoloji</groupId>
3
<artifactId>desk360-android-sdk</artifactId>
4
<version>Tag</version>
5
</dependency>
Copied!

Add to your AndroidManifest.xml

1
<application
2
...
3
<activity
4
android:name="com.teknasyon.desk360.view.activity.Desk360BaseActivity"
5
android:windowSoftInputMode="stateHidden|adjustResize"
6
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
7
</application>
Copied!

Network Security Config

Create network_security_config.xml and add it to your application.
1
<?xml version="1.0" encoding="utf-8"?>
2
<network-security-config>
3
<domain-config cleartextTrafficPermitted="true">
4
<domain includeSubdomains="true">teknasyon.desk360.com</domain>
5
</domain-config>
6
</network-security-config>
7
Copied!
Add reference to new created network security config in application tag in your manifest file
1
<application
2
...
3
android:networkSecurityConfig="@xml/network_security_config"
4
5
</application>
Copied!
or you can just add this line to your application
1
<application
2
...
3
android:usesCleartextTraffic="true"
4
5
</application>
Copied!

ProGuard

If you are using ProGuard you must add this rules to avoid further compile issues.
1
-keep class com.teknasyon.desk360.model.** { *; }
2
-keepnames class com.teknasyon.desk360.model.** { *; }
3
-keep class com.teknasyon.desk360.modelv2.** { *; }
4
-keepnames class com.teknasyon.desk360.modelv2.** { *; }
Copied!

Usage

Desk360 helper method returns an intent to open Desk360 screen. Target ID is the ID of a ticket opened with a notification. If there is no intent to open a ticket page directly this parameter can be passed blank. Push token can be fetched from Firebase Messaging SDK. If notification integration won’t be used, this parameter can be left blank.

Start Desk360

1
val desk360SDKManager = Desk360SDKManager.Builder()
2
.appKey(BuildConfig.APP_KEY)
3
.appVersion(BuildConfig.VERSION_NAME)
4
.languageCode("tr")
5
.environment(Environment.PRODUCTION)
6
.platform(Platform.GOOGLE)
7
.countryCode("de")
8
.theme(1)
9
.jsonObject(JSONObject())
10
.addIntentFlags(
11
arrayOf(
12
Intent.FLAG_ACTIVITY_CLEAR_TOP,
13
Intent.FLAG_ACTIVITY_SINGLE_TOP
14
)
15
)
16
.name("user name")
17
.emailAddress("[email protected]")
18
.build()
19
20
val desk360Client = desk360SDKManager.initialize(_targetId = target_id, _token = push_token, _deviceToken = uuid)
21
desk360Client.start(this)
Copied!
Parameters
Description
token
Firebase token
targetId
ticket ID from Firebase message body
appKey
desk360 API Key will provided when you get the license
appVersion
version number of your application
deviceToken
your Android device ID
appLanguage
Code for SDK languages: "en" , "fr" , "tr"
environment
Production for prod Sandbox for development
platform
Only for devices with Huawei Mobile Service (hms): Platform.HUAWEI For others: Platform.GOOGLE
appCountryCode
Country Code
name
User name
emailAddress
User email address
enableHelpMode
Enable or disable the additional help page
GetFirebase Token
1
FirebaseInstanceId.getInstance().instanceId
2
3
.addOnCompleteListener { task ->
4
5
if (task.isSuccessful && task.result != null) {
6
val token = task.result!!.token
7
}
8
}
Copied!
Parse "targetId" from Firebase Notification Body (Firebase Notification Service)
When your application is on foreground onMessageReceived will handle notification body.
1
override fun onMessageReceived(remoteMessage: RemoteMessage) {
2
super.onMessageReceived(remoteMessage)
3
4
val hermes = remoteMessage.data["hermes"]
5
6
hermes?.let {
7
val targetId = Desk360Constants.getTicketId(hermes)
8
}
Copied!
Handling "targetId"
If target_id is not null you must open Desk360SplashActivity if not you must open your starting activity
1
Example (In your firebaseMessagingService class) :
2
3
val pendingIntent: PendingIntent?
4
5
pendingIntent = targetId?.let { targetId ->
6
val desk360SDKManager = Desk360SDKManager.Builder()
7
.appKey("app key")
8
.appVersion("app version")
9
.languageCode("your selected ISO 639-1 Code for language: tr, en")
10
.environment("environment info: Environment.PRODUCTION or Environment.SANDBOX" )
11
.platform("mobile platform: Platform.GOOGLE or Platform.HUAWEI")
12
.countryCode("country code: tr, de")
13
.theme("theme id")
14
.jsonObject("for custom data")
15
.addIntentFlags(arrayOf(Intent.FLAG_ACTIVITY_CLEAR_TOP, Intent.FLAG_ACTIVITY_SINGLE_TOP))
16
.name("user name")
17
.emailAddress("user mail address")
18
.build()
19
val desk360Client = desk360SDKManager.initialize(
20
_targetId = "targetId from notification body",
21
_token = "your firebase token",
22
_deviceToken = "your Android device id"
23
)
24
val intent = desk360Client.getIntent(this)
25
PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT)
26
} ?: run {
27
PendingIntent.getActivity(this, 0, Intent(this, YourStartingActivity::class.java), PendingIntent.FLAG_ONE_SHOT)
28
}
Copied!
Parse "targetId" from Firebase Notification Body (Starting Activity)
When your application is killed the notification body will be in your starting activity's extra.
1
val bundle = intent.extras
2
bundle?.let {
3
4
val hermes = bundle?.getString("hermes")
5
hermes?.let {
6
val targetId = Desk360Constants.getTicketId(hermes)
7
}
8
}
Copied!
Open Desk360 without Notification Service
If your app will not use notification then you must set token "and for targetId"
1
val desk360SDKManager = Desk360SDKManager.Builder()
2
.appKey("app key")
3
.appVersion("app version")
4
.languageCode("your selected ISO 639-1 Code for language: tr, en")
5
.environment("String flag for sandbox or production environment info")
6
.platform("Only hms device Platform.HUAWEI, others Platform.GOOGLE")
7
.countryCode("country code: tr, de")
8
.theme("theme id")
9
.jsonObject("for custom data")
10
.addIntentFlags(arrayOf(Intent.FLAG_ACTIVITY_CLEAR_TOP, Intent.FLAG_ACTIVITY_SINGLE_TOP))
11
.name("user name")
12
.emailAddress("user mail address")
13
.build()
14
15
val desk360Client = desk360SDKManager.initialize(
16
_targetId = "targetId from notification body",
17
_token = "your firebase token",
18
_deviceToken = "your Android device id"
19
)
20
21
startActivity(desk360Client.getIntent(this))
22
finish()
Copied!
Language
If you don't want to use custom language then you must set to "", desk360 SDK will use your Android device language
Customize Desk360 Theme
You should use Desk360 dashboard for custom config. For further information, please contact us via [email protected]
Last modified 1mo ago
Copy link