Getting Started

The Getting Started guide shows you how to setup and launch Referral Campaign as quickly as possible with Talkable Android SDK.

Installation

  1. Add the JitPack repository to your project’s top level build.gradle file.

    allprojects {
      repositories {
        ...
        maven { url 'https://jitpack.io' }
      }
    }
    
  2. Add TalkableSDK as a dependency to your module’s build.gradle file.

    dependencies {
      ...
      implementation 'com.github.talkable:android-sdk:0.5.12'
    }
    
  1. Setup Talkable credentials in AndroidManifest.xml file inside <application> element in the following format:

    <application>
        ...
        <meta-data
            android:name="tkbl-api-key-{{YOUR_SITE_ID}}"
            android:value="{{YOUR_TALKABLE_PUBLIC_API_KEY}}" />
        ...
    </application>
    

    Note

    You can locate your credentials inside Talkable site:

    • Select site and go to DashboardSettingsSite Settings. Find API integration section and there you will see your API Keys and Site ID (also known as Site slug). Use only the Public API Key in your production application.

  1. Add deep linking scheme handler into your main activity entry or an activity you want to handle deep links from Talkable.

    <activity>
        ...
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
    
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
    
            <data android:scheme="tkbl-{{YOUR_SITE_ID}}" />
        </intent-filter>
    </activity>
    
  1. Initialize Talkable in the Application:

    import com.talkable.sdk.Talkable;
    import android.app.Application;
    
    public class App extends Application {
        @Override
        public void onCreate() {
            super.onCreate();
            Talkable.initialize(this);
        }
    }
    

    Note

    Make sure to add your application class name as android:name parameter of the <application> element in your manifest

  2. Call Talkable.trackAppOpen inside you main activity class, like this:

    import com.talkable.sdk.Talkable;
    import android.app.Activity;
    
    public class MainActivity extends Activity {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            ...
    
            Talkable.trackAppOpen(this);
        }
    }
    

Here is an example of AndroidManifest.xml file (with "demo-site" site ID) you should setup after steps above:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.talkable.demo">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:name=".App">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="tkbl-demo-site" />
            </intent-filter>
        </activity>

        <!-- Talkable -->

        <meta-data
            android:name="tkbl-api-key-demo-site"
            android:value="nacsc9XseW4Kxne6AaJ" />

        <!-- End Talkable -->
    </application>
</manifest>

Your environment is all set up! Now you need to integrate the Talkable campaign piece.

Requirements

The SDK supports Android 4.1 and later.