Integration Guide

Our Mobile Support SDK enables you to add a knowledge base (Helpcenter) and an in-app chat (Messenger) to your apps in a plug-and-play fashion.

Prerequisites

The following steps assume that you are using Android Studio and the Gradle build system.

Please ensure that your application at least supports v14 (Ice Cream Sandwich).

Setting up the SDK

To get started, please follow the steps below. You will be making changes to the following files:

├── build.gradle
├── src/
|   ├── main/
|   |   ├── AndroidManifest.xml
|   |   ├── java/
|   |   |   ├── MainActivity.java
|   |   |   ├── MySampleApplication.java
|   |   ├── res/
|   |   |   ├── values/
|   |   |   |   ├── styles.xml
|   |   |   |   ├── colors.xml

Note: For a better understanding, do go through the source code of the sample app here.

Step 1: build.gradle

Add the following lines to your module's build.gradle file:

android {
    //...
    packagingOptions {
        exclude 'META-INF/LICENSE'
    }
}

dependencies {
    //...
    compile 'com.kayako.messenger:kayako-messenger:1.0.+'
}

Step 2: AndroidManifest.xml

Add the following lines to your AndroidManifest.xml file.

Copy and paste the following lines inside the Manifest tags but above the Application tags.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Copy and paste the following lines in between the Application tags.

<!-- Helpcenter Activities -->
<activity
    android:name="com.kayako.sdk.android.k5.activities.KayakoHelpCenterActivity"
    android:theme="@style/HelpCenterTheme" />
<activity
    android:name="com.kayako.sdk.android.k5.activities.KayakoSearchArticleActivity"
    android:launchMode="singleTask"
    android:theme="@style/Ko__SearchArticlePageTheme"
    android:windowSoftInputMode="adjustPan|stateVisible" />
<activity
    android:name="com.kayako.sdk.android.k5.activities.KayakoArticleActivity"
    android:theme="@style/HelpCenterTheme" />

<!-- Messenger Activities -->
<activity
    android:name="com.kayako.sdk.android.k5.activities.KayakoConversationListActivity"
    android:theme="@style/MessengerTheme" />
<activity
    android:name="com.kayako.sdk.android.k5.activities.KayakoSelectConversationActivity"
    android:theme="@style/MessengerTheme" />
<activity
    android:name="com.kayako.sdk.android.k5.activities.KayakoMessengerActivity"
    android:theme="@style/MessengerTheme" />
<activity
    android:name="com.kayako.sdk.android.k5.activities.KayakoAttachmentPreviewActivity"
    android:theme="@style/MessengerTheme" />

Step 3: styles.xml

Paste the following lines to your res/values/styles.xml file.

<!-- Helpcenter Theme -->
<style name="HelpCenterTheme" parent="Ko__AppTheme">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<!-- Messenger Theme -->
<style name="MessengerTheme" parent="Ko__MessengerTheme">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

Step 4: colors.xml

Please ensure that the following color names are mentioned in your res/values/colors.xml file.

<color name="colorPrimary">ADD_COLOR_HERE</color>
<color name="colorPrimaryDark">ADD_COLOR_HERE</color>
<color name="colorAccent">ADD_COLOR_HERE</color>

Note: For advanced customization options, go through the following:

Step 5: Application class

Extend your Application class and add the following lines to your onCreate() method:

Kayako.initialize(this);

Step 6: Open Activity

Good Work! You've just completed the steps to the integration guide. To get started on using the SDK, go through the following links:

Additional Configuration

If you’re using proguard, please add the following code to your proguard-project.txt file

# OkHttp3
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**

# Glide

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
    **[] $VALUES;
    public *;
}

# Kayako Android SDK

-keep class com.kayako.sdk.android.k5.** { *; }
-dontwarn com.kayako.sdk.android.k5.**
-keepattributes InnerClasses

# Android

-keep class android.support.v4.** { *; }

# Phoenix client library

-keepnames class org.phoenixframework.channels.** { *; }
-keep public class org.phoenixframework.channels.** {
  public *** get*();
  public void set*(***);
}
-keep class com.fasterxml.jackson.databind.ObjectMapper {
    public <methods>;
    protected <methods>;
}
-keep class com.fasterxml.jackson.databind.ObjectWriter {
    public ** writeValueAsString(**);
}
-keep class com.fasterxml.jackson.annotation.** { *; }
-keepnames class com.fasterxml.jackson.** { *; }
-keepattributes Annotation,EnclosingMethod,Signature
-keepclassmembers public final enum org.codehaus.jackson.annotate.JsonAutoDetect$Visibility {
public static final org.codehaus.jackson.annotate.JsonAutoDetect$Visibility *; }
-keep class org.codehaus.* { *; }
-dontwarn org.w3c.dom.bootstrap.DOMImplementationRegistry
-dontwarn com.fasterxml.jackson.databind.**


For more information on proguard, access the proguard documentation: http://developer.android.com/tools/help/proguard.html

Dependency Graph

# Android Support Dependencies
- com.android.support:appcompat-v7:24.2.1
- com.android.support:recyclerview-v7:24.2.1
- com.android.support:support-v4:24.2.1
- com.android.support:design:24.2.1

# Third Party Dependencies
- com.squareup.okhttp3:okhttp:3.4.2
- com.squareup.okio:okio:1.9.0
- com.google.code.gson:gson:2.4
- com.github.bumptech.glide:glide:3.8.0
- org.threeten:threetenbp:1.3.3 // added in v1.0.2

# Kayako Internal Dependencies
- com.kayako:kayako:1.0.0 // version updated in v1.0.2
- com.kayako.kre:kre-client:0.2.13 // added in v1.0.2

Source Code & Licensing

The source code is available on the following github repository:

https://github.com/kayako/Kayako-Android-SDK

The source code is distributed under the Apache 2.0 License:

https://www.apache.org/licenses/LICENSE-2.0