Android SDK
Related Articles
Install the new software development kit (SDK) that will enable you to create an application for the Android platform. Here’s a link to GitHub.
Installation
Paldesk Android SDK requires a device with minimum Android API version 16.
Steps:
1. Add Paldesk repository in your current repositories in project’s root build.gradle:
allprojects {
repositories {
…
maven { url “https://s3-eu-west-1.amazonaws.com/paldesk-maven/release/” }
…
}
2. Add dependency in your applications build.gradle:
dependencies {
implementation ‘com.paldesk.android:paldesk-sdk:1.0.2’
}
3. Add these permissions to your Manifest file:
<uses-permission android:name=”android.permission.INTERNET” />
<uses-permission android:name=”android.permission.READ_EXTERNAL_STORAGE”/>
Usage
Initialize Paldesk with your API Key in your Application class:
@Override
public void onCreate() {
super.onCreate();
PaldeskSDK.init(this, “your api key”);
//…
}
If you wish to enable logging, just add “loggingEnabled” parameter to initialize method:
PaldeskSDK.init(this, “your api key”, true);
Starting conversation
To start a conversation from your app, use:
PaldeskSDK.startConversation(this)
Creating client
Depending on your Client authentification type settings from
Webapp -> Administration -> Android SDK (https://www.paldesk.com/), you can choose three options:
- No data required – the client will appear as “visitor” – you are free to start a conversation without setting information about your client
- You provide information about the client through code – you can create a client when your client becomes available to you with the following method:
ClientParams clientParams = new ClientParams.Builder(“email”, “externalId”)
.firstName(“First Name”)
.lastName(“Last Name”)
.build();
PaldeskSDK.createClient(clientParams);
Clearing client
To clear (log out) current client, use:
PaldeskSDK.clear();
Important: If you call create client method multiple times, it will matter only first time. If you wish to create different client, please call clear method first and then you are able to create client again.