Get Started

Configure and Initialize TapTalk.io Omnichannel Android SDK

Step 1: Install TapTalk.io SDK

To start, open your Android project and add the following repositories to your top-level build.gradle file.

Project build.gradle
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
}
}

Then add the following dependency to your app-level build.gradle:

app module build.gradle
dependencies {
implementation 'com.github.taptalk-io:taptalk.io-android:1.0.21'
}

Note: In the app build.gradle file, make sure that your project is using supported Java 8 language features under the android tag like below

app module build.gradle
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

Step 2: Initialize TapTalkLive

In order to use TapTalkLive SDK, you must first initialize a TapTalkLive instance by passing the CONTEXT, APP_KEY_SECRET, API_BASE_URL, CLIENT_APP_ICON, and CLIENT_APP_NAME assigned to your application to the init method as a parameter. Generally, initialization is implemented in the Application class in your project.

Java
Kotlin
Java
Application.java
TapTalkLive.init(
CONTEXT,
APP_KEY_SECRET,
API_BASE_URL,
CLIENT_APP_ICON,
CLIENT_APP_NAME,
tapTalkLiveListener);
Kotlin
Application.kt
TapTalkLive.init(
CONTEXT,
APP_KEY_SECRET,
API_BASE_URL,
CLIENT_APP_ICON,
CLIENT_APP_NAME,
tapTalkLiveListener)

Parameters

CONTEXT (Context) application context APP_KEY_SECRET: (String) application key Secret API_BASE_URL: (String) base API URL CLIENT_APP_ICON: (int) drawable resource ID of your application's icon CLIENT_APP_NAME: (String) your application name tapTalkLiveListener: (TapTalkLiveListener) an interface to detect TapTalkLive Android SDK's delegates and callbacks

Setup FileProvider in your application

To enable file transfer through chat messages, you need to define FileProvider in your application's AndroidManifest.xml file, under the <application> tag.

AndroidManifest.xml
<application
android:name=".YourApplication"
...>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>

Initialize Google Places API Key (Optional)

To enable location search result preview while sending location message, a Google Places API Key is required. To obtain the API key for your application, you can check the documentation provided by Google. To initialize, insert your obtained key using the initializeGooglePlacesApiKey() method after TapTalkLive SDK has completed its initialization.

Java
Kotlin
Java
TapTalkLive.initializeGooglePlacesApiKey(GOOGLE_MAPS_API_KEY);
Kotlin
TapTalkLive.initializeGooglePlacesApiKey(GOOGLE_MAPS_API_KEY)

Your key also needs to be defined in your application's AndroidManifest.xml file, under the <application> tag.

AndroidManifest.xml
<application
android:name=".YourApplication"
...>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="GOOGLE_PLACES_API_KEY" />
</application>

Parameters

GOOGLE_PLACES_API_KEY: (String) Google Places API Key

Open TapTalk Omnichannel View

To open TapTalkLive's view UI for your application, you can use the openTapTalkLiveView method from the TapTalkLive class. This will open an activity containing a chat room list for your user, and will open a Create Case Form activity on top if the user is new or do not have any existing case.

Java
Kotlin
Java
YourActivity.java
TapTalkLive.openTapTalkLiveView(YourActivity.this);
Kotlin
YourActivity.java
TapTalkLive.openTapTalkLiveView(this@YourActivity)

openTapTalkLiveView will return true if opening the view is successful, and will return false if it fails due to incomplete initialization.