Installation

Prerequisite

  • minSdkVersion ≥ 15
  • Android Support Library Version ≥ 27.1.0
  • Android gradle plugin ≥ 4.0.0
android {
    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

SDK Latest Version

Maven CentralMaven Central

Step 1. Install ChannelIO

Add mavenCentral repository to root build.gradle file

allprojects {
    repositories {
        mavenCentral()
    }
    dependencies {
        // from 4.0.0
        classpath "com.android.tools.build:gradle:4.0.0"
    }
}

Add the following dependency to your app's build.gradle file:

dependencies {
    implementation 'io.channel:plugin-android:$[version]'

    // If you already set FCM in your project, skip this dependency.
    implementation 'io.channel:plugin-android-fcm:$[version]'
}

ProGuard (Optional)

Depending on your ProGuard (DexGuard) config and usage, you may need to include the following lines in your proguard

-keep class com.zoyi.**{
   *;
}
-dontwarn com.zoyi.**

🚧

Check your resConfigs in build.gradle

Currently, Korean, English and Japanese are available.
If some languages are not applied in resConfigs like 'ko' or 'ja',
some places can be shown in English.

Step 2. Initialize ChannelIO

You should initialize ChannelIO by calling onCreate() method of your application class:

See ChannelIO

public class MyApplication extends Application {
  @Override
  public void onCreate() {
    super.onCreate();
    
    ChannelIO.initialize(this);

    // TODO : Your code   
  }
}

🚧

Always initialize Channel in Application onCreate() method

Initializing Channel any other places would cause unexpected behavior.

Note: If you don't have a custom application class, you should create one. Then, You’ll need to update your manifest to use application :

<application
    android:name=".MyApplication">
</application>

❗️

HTTP Web link redirect is default disabled from API 28

To use http link, please choose one of the two methods below to apply.

Global apply

<application
    android:usesCleartextTraffic="true">
</application>

Partial apply
Follow this link

<application
    android:networkSecurityConfig="@xml/FILE_NAME">
</application>

Step 3. Using ChannelIO

To use ChannelIO, you first need to obtain a pluingKey from Channel Desk. With this key, you can start to use ChannelIO in your application immediately by using boot method. You can either start ChannelIO with anonymous user or registered user.

Booting with a anonymous user

If you boot as an anonymous user, you only need to set the plugin.

BootConfig bootConfig = BootConfig.create(YOUR_PLUGIN_KEY);
ChannelIO.boot(bootConfig);

Booting with a registered user

To boot as a registered user, you need to set memberId in BootConfig object.

📘

Please set memberId when you are integrating for registered users.

We distinguish anonymous users and registered users based on memberId property in BootConfig.

🚧

Conversation from an anonymous user to a registered user will not be interlinked

Anonymous user conversations and registered use conversations are not interlinked because they are difficult to logically combine. Please contact the development team if you need to have interworking.

You can pass any other information about the a user into Profile object.

Profile profile = Profile.create()
    .setName(userName)
    .setEmail(userEmail)
    .setProperty("homePageUrl", "channel.io");

BootConfig bootConfig = new BootConfig(YOUR_PLUGIN_KEY)
    .setMemberId(uniqueUserId)
    .setProfile(profile);

ChannelIO.boot(bootConfig);

Set channel button visibility

We provide the default launcher and its visibility can be controlled by calling showChannelButton, hideChannelButton methods. You have to configure its visibility based on your view if you only want to display it on certain views.

ChannelIO.showChannelButton();
ChannelIO.hideChannelButton();

📘

Customize channel button

You can change the position of the default launcher button and replace the default button with a custom button. Please refer to docs for more detail.

Now, all the steps are over!

Boot Callback

If you register the listener, it receives the boot status.

ChannelIO.boot(BootConfig bootConfig, BootCallback callback);

Refer to the BootStatus for a description of Boot Status.

Sleep

To stop interaction and only can send event or receive push notification, call sleep

ChannelIO.sleep();

Shutdown

To terminate ChannelIO (typically when a user logout from your application), simply call

ChannelIO.shutdown();

🚧

Caution!

Shutdown users can't receive ChannelIO notification.