Customization

Customizing launcher

Change channel button position

If you use channel button, you can change button position by using ChannelButtonOption

BootConfig bootConfig = BootConfig.create(YOUR_PLUGIN_KEY)
  .setChannelButtonOption(new ChannelButtonOption(ChannelButtonPosition.RIGHT, 16, 16));

Set custom launcher button

If you wish to use a customized launcher button instead of the default one provided by Channel, implement your own button and call ChannelIO.showMessenger in it.

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

  <Button
      android:id="@+id/btn_launch_channel"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Show Channel Plugin"/>
</FrameLayout>
public class MyActivity extends Activity {

  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_example);

    findViewById(R.id.btn_launch_channel).setOnClickListener({ v ->
      ChannelIO.showMessenger(MyActivity.this);
    });
  }
}

Unread Message Count

If you use customized button, we highly recommend you to show unread message count manually.
See onBadgeChanged

public class MyActivity extends Activity implements
ChannelPluginListener {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    ...
    ChannelIO.setListener(this);
    ...
  }
 
  @Override
  public void onBadgeChanged(int count) {
    // change your own badge.
  }
}

Customizing in-app push

Set in-app push visibility
A user will get in-app push notification when a manager send a message through channel. You can control in-app push visibility to set hidePopup in BootConfig

BootConfig bootConfig = BootConfig.create(pluginKey)
    .setHidePopup(hidePopup);

Receiving in-app push event
To receive push notification's information, you need to implement onPopupDataReceived from ChannelPluginListener and use PopupData to display proper information on your customized view.

public class MyActivity extends Activity implements ChannelPluginListener {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    ...
    ChannelIO.setListener(this);
    ...
  }
 
  @Override
  public void onPopupDataReceived(PopupData popupData) {
    // on receiving push data, use this data to display customized push view
  }
}

Tracking event

You can log events with ChannelIO that records user behaviors in your application by using Track . For example, you can record a certain page users visited from your application and when they visited.

private void trackMyEvent() {
  ChannelIO.track("TestEvent", ImmutableMap.of(
      "key1", "value1",
      "key2", 2
  ));
}