Get Started
Before you get started: Make sure you have created a channel in OneTalk dashboard and obtain the APP_KEY_SECRET.

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
1
allprojects {
2
repositories {
3
google()
4
jcenter()
5
maven { url 'https://jitpack.io' }
6
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
7
}
8
}
Copied!
Then add the following dependency to your app-level build.gradle:
app module build.gradle
1
dependencies {
2
implementation 'com.github.taptalk-io:taptalk.io-omnichannel-android:1.0.12'
3
}
Copied!
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
1
android {
2
3
...
4
5
compileOptions {
6
sourceCompatibility JavaVersion.VERSION_1_8
7
targetCompatibility JavaVersion.VERSION_1_8
8
}
9
}
Copied!

Step 2: Initialize TapTalkLive

In order to use TapTalkLive SDK, you must first initialize a TapTalkLive instance by passing the CONTEXT, APP_KEY_SECRET, 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
Application.java
1
TapTalkLive.init(
2
CONTEXT,
3
APP_KEY_SECRET,
4
CLIENT_APP_ICON,
5
CLIENT_APP_NAME,
6
new TapTalkLiveListener() {
7
@Override
8
public void onInitializationCompleted() {
9
super.onInitializationCompleted();
10
}
11
12
@Override
13
public void onCloseButtonInCreateCaseFormTapped() {
14
super.onCloseButtonInCreateCaseFormTapped();
15
}
16
17
@Override
18
public void onCloseButtonInCaseListTapped() {
19
super.onCloseButtonInCaseListTapped();
20
}
21
});
Copied!
Application.kt
1
TapTalkLive.init(
2
CONTEXT,
3
APP_KEY_SECRET,
4
CLIENT_APP_ICON,
5
CLIENT_APP_NAME,
6
object : TapTalkLiveListener() {
7
override fun onInitializationCompleted() {
8
super.onInitializationCompleted()
9
}
10
11
override fun onCloseButtonInCreateCaseFormTapped() {
12
super.onCloseButtonInCreateCaseFormTapped()
13
}
14
15
override fun onCloseButtonInCaseListTapped() {
16
super.onCloseButtonInCaseListTapped()
17
}
18
})
Copied!

Parameters

CONTEXT (Context) application context APP_KEY_SECRET: (String) application key Secret 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
1
<application
2
android:name=".YourApplication"
3
...>
4
5
<provider
6
android:name="android.support.v4.content.FileProvider"
7
android:authorities="${applicationId}.fileprovider"
8
android:exported="false"
9
android:grantUriPermissions="true">
10
<meta-data
11
android:name="android.support.FILE_PROVIDER_PATHS"
12
android:resource="@xml/file_paths" />
13
</provider>
14
15
</application>
Copied!

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
1
TapTalkLive.initializeGooglePlacesApiKey(GOOGLE_MAPS_API_KEY);
Copied!
1
TapTalkLive.initializeGooglePlacesApiKey(GOOGLE_MAPS_API_KEY)
Copied!
Your key also needs to be defined in your application's AndroidManifest.xml file, under the <application> tag.
AndroidManifest.xml
1
<application
2
android:name=".YourApplication"
3
...>
4
5
<meta-data
6
android:name="com.google.android.geo.API_KEY"
7
android:value="GOOGLE_PLACES_API_KEY" />
8
9
</application>
Copied!

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
YourActivity.java
1
TapTalkLive.openTapTalkLiveView(YourActivity.this);
Copied!
YourActivity.java
1
TapTalkLive.openTapTalkLiveView(this@YourActivity)
Copied!
openTapTalkLiveView will return true if opening the view is successful, and will return false if it fails due to incomplete initialization. TapTalkLive initialization might not be completed if the device is not connected to internet or an incorrect APP_KEY_SECRET parameter was provided.