Giter Site home page Giter Site logo

teknasyon-teknoloji / desk360-android-sdk Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 2.0 2.52 MB

Desk360 Android SDK

Home Page: https://docs.desk360.com/sdk/android-sdk

License: MIT License

Java 5.17% Kotlin 94.83%
desk360 sdk customer-support support ticket-management

desk360-android-sdk's Introduction

Desk360 Android SDK

img img

Table Of Content

Summary

Desk360 is an Android SDK to help your embedding customer support in your mobile Android apps with ease.

Features

The Desk360 SDK lets users do any of the following:

Create new support tickets View and comment on existing tickets Interactively communicate with related support teams

Installation

Setup

To integrate Desk360 into your Android project , add below parts to your build.gradlle

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add the dependency

dependencies {
    implementation 'com.github.Teknasyon-Teknoloji:desk360-android-sdk:latest_release'
}

Add Data and View Binding enable script

apply plugin: 'kotlin-kapt'

android {
    
    buildFeatures {
        dataBinding true
    }
}

(Please change latest_release with : https://img.shields.io/jitpack/v/github/Teknasyon-Teknoloji/desk360-android-sdk)

Usage

Start Desk360
import com.teknasyon.desk360.helper.Desk360Config
import com.teknasyon.desk360.helper.Desk360SDKManager
import com.teknasyon.desk360.helper.Platform
import com.teknasyon.desk360.helper.Desk360SDK
        val desk360SDKManager = Desk360SDKManager.Builder(context:Context)
            .setAppKey(key:String)
            .setAppVersion(version:String)
            .setLanguageCode(languageCode:String)
            .setPlatform(platform:Platform)
            .setCountryCode(countryCode:String)
            .setCustomJsonObject(
                JSONObject(
                    "{\n" +
                            "  \"name\":\"Desk360\",\n" +
                            "  \"age\":3,\n" +
                            "  \"cars\": {\n" +
                            "    \"car1\":\"MERCEDES\",\n" +
                            "    \"car2\":\"BMW\",\n" +
                            "    \"car3\":\"AUDI\"\n" +
                            "  }\n" +
                            " }"
                )
            )
            .build()

        desk360SDKManager.initialize("firebase notification token", "device id")

        Desk360SDK.start()
Parameters Description
token your notification token
deviceId your Android device id
appKey desk360 Api Key will provided when you get the license
appVersion your application's version number
languageCode ISO 639-1 Code for sdk language: "en","fr,"tr
platform mobile platform: Platform.GOOGLE or Platform.HUAWEI
countryCode country code: "tr", "us", "de"
jsonObject for custom datas

Get Notification Token

If FCM is used as notification service;

FirebaseInstanceId.getInstance().instanceId

                .addOnCompleteListener { task ->
		
                    if (task.isSuccessful && task.result != null) {
                       val token = task.result!!.token
                    }
                }	

If Huawei Push Kit is used as notification service;

private fun getToken() {   
    // Create a thread.
    object : Thread() {
        override fun run() {
            try {
                // Obtain the app ID from the agconnect-services.json file.
                val appId = "your APP_ID"    
            
                // Set tokenScope to HCM.
                val tokenScope = "HCM"
                val token = HmsInstanceId.getInstance(this@MainActivity).getToken(appId, tokenScope)                
                              
           } catch (e: ApiException) {        
               Log.e(TAG, "get token failed, $e")               
           }     
        }  
    }.start()
}

Parse "targetId" from Firebase Notification Body (Starting Activity)

When your application is killed the notification body will be in your starting activity's extra.

val bundle = intent.extras
        bundle?.let {
	
	val hermes = bundle?.getString("hermes")
            hermes?.let {
		val targetId = Desk360SDK.getTicketId(hermes)
    	}	
  }

Parse "targetId" from Firebase Notification Body (Firebase Notification Service)

When your application is on foreground onMessageReceived will handle notification body.

override fun onMessageReceived(remoteMessage: RemoteMessage) {
        super.onMessageReceived(remoteMessage)

        val hermes = remoteMessage.data["hermes"]

        hermes?.let {
	val targetId = Desk360SDK.getTicketId(hermes)
    }
    

Handling "targetId"

If target_id is not null you must open Desk360SplasActivity if not you must open your starting activity.

Example (In your firebaseMessagingService class) :

 val pendingIntent: PendingIntent?

        pendingIntent = targetId?.let { targetId ->

        val desk360SDKManager = Desk360SDKManager.Builder(context)
            .setAppKey("app key")
            .setAppVersion("app version")
            .setLanguageCode("your selected ISO 639-1 Code for language: tr, en")
            .setPlatform("mobile platform: Platform.GOOGLE or Platform.HUAWEI")
            .setCountryCode("country code: tr, de")
            .setCustomJsonObject("for custom data")
            .build()

             desk360SDKManager.initialize(
                      notificationToken = "your firebase token",
                      deviceId = "your Android device id"
             )

             val intent = Desk360SDK.getIntent(context:Context, ticketId:String?)
             PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT)
        } ?: run {
            PendingIntent.getActivity(this, 0, Intent(this, YourStartingActivity::class.java), PendingIntent.FLAG_ONE_SHOT)
        }

Use Desk 360

       val desk360SDKManager = Desk360SDKManager.Builder(context)
            .setAppKey("app key")
            .setAppVersion("app version")
            .setLanguageCode("your selected ISO 639-1 Code for language: tr, en")
            .setPlatform("mobile platform: Platform.GOOGLE or Platform.HUAWEI")
            .setCountryCode("country code: tr, de")
            .setCustomJsonObject("for custom data")
            .build()

       desk360SDKManager.initialize(
             notificationToken = "your firebase token",
             deviceId = "your Android device id"
       )

        Desk360SDK.start()
        finish()		

Open Desk360 without Notification Service

If your app will not use notification then you must set token "" and for targetId ""

       val desk360SDKManager = Desk360SDKManager.Builder(context)
            .setAppKey("app key")
            .setAppVersion("app version")
            .setLanguageCode("your selected ISO 639-1 Code for language: tr, en")
            .setPlatform("mobile platform: Platform.GOOGLE or Platform.HUAWEI")
            .setCountryCode("country code: tr, de")
            .setCustomJsonObject("for custom data")
            .build()

       desk360SDKManager.initialize(
             notificationToken = "your firebase token",
             deviceId = "your Android device id"
       )

        Desk360SDK.start()
        finish()

Language

If you don't want to use custom language then you must set to "" , desk360 sdk will use your Android device language

ProGuard

If you are using proguard you must add this rules to avoid further compile issues.


-keep class com.teknasyon.desk360.model.** { *; }
-keepnames class com.teknasyon.desk360.model.** { *; }
-keep class com.teknasyon.desk360.modelv2.** { *; }
-keepnames class com.teknasyon.desk360.modelv2.** { *; }

Versioning

We use SemVer for versioning.

Support

If you have any questions or feature requests, please create an issue.

Licence

Copyright Teknasyon 2022.

Desk360 is released under the MIT license. See LICENSE for more information.

desk360-android-sdk's People

Contributors

brnogz avatar burakocak avatar emrealp avatar mskahraman avatar mskteknasyon avatar seyfullahpolat avatar seyfullahpolatteknasyon avatar yasincetin002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

desk360-android-sdk's Issues

jCenter dependency

Merhaba,
io.paperdb:paperdb surumunu 2.7.1 yapabilir misiniz (groupId farklı bir de), 2.6 jCenter'da var sadece

Desk360

Desk360 android SDK xiaomi device

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.