Skip to content

paldesk/paldesk-android-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Paldesk

Installing

Paldesk SDK requires device with minimum Android API version 16.

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/" }
		...
}

Add dependency in your applications build.gradle:

dependencies {
    implementation 'com.paldesk.android:paldesk-sdk:1.0.7'
}

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 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 - client will appear as “visitor” - you are free to start conversation without setting information about your client
  • You provide information about client through code - you can create client when your client becomes available to you with following method:
ClientParams clientParams = new ClientParams.Builder("externalId")
    .firstName("First Name")
    .lastName("Last Name")
    .email("email")
    .build();
                
PaldeskSDK.createClient(clientParams);

or with callback:

ClientParams clientParams = new ClientParams.Builder("externalId")
    .firstName("First Name")
    .lastName("Last Name")
    .email("email")
    .build();
                
 PaldeskSDK.createClient(clientParams, new PaldeskSDK.PDClientCallback() {
    @Override
    public void onSuccess() {
       // your code here
    }

    @Override
    public void onError() {
       // your code here
    }
});

ExternalId field is mandatory and other fields are optional. ExternalId should be something unique from your side, preferably your client's id (or even email). If client information is not provided, your client will appear as “visitor". You can explicitly create "visitor" by calling:

PaldeskSDK.createAnonymousClient()

or with callback:

PaldeskSDK.createAnonymousClient(new PaldeskSDK.PDClientCallback() {
   @Override
   public void onSuccess() {
       // your code here
   }

   @Override
   public void onError() {
       // your code here
   }
});
  • Client provides his information through form - your usr will have to provide his information in registration form which will be shown on first start (prior to starting conversation).

Clearing client

To clear (logout) 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.