Channel Developers

The initialize function is responsible for initializing ChannelIO and should be invoked prior to any other methods of ChannelIO.

Parameter

Type

Default Value

Description

application

@NonNullApplication

Required

An Application instance.

attachView

boolean

true

When set totrue, the SDK will automatically attach a view to display the channel button and marketing pop-ups within your activity.To exclude specific activities from this view attachment, use@SkipAttachChannelView. If set tofalse, the view won't be automatically attached, and you'll need to use the ChannelPluginListenerChannelPluginListener to display an appropriate UI.

Sets a callback to be invoked when an event occurs.

Parameter

Type

Default Value

Description

listener

@Nullable ChannelPluginListener

Required

A listener instance to be invoked when the eventoccurs. If null,the listener will be removed.

Removes a listener instance previously set by setListener. A shortcut for setListener(null).

Prepares for channel-specific features such as showing a messenger and a real-time chat. See how to use Channel Talk. Use the bootCallback parameter to define the task to be done after the boot is complete.

Parameter

Type

Default Value

Description

bootConfig

@NonNull BootConfig

Required

A boot configuration. You can set values such as plugin key and position of the channel button.

bootCallback

@Nullable BootCallback

null

A callback to be invoked when the boot completes.

Use sleep() or shutdown() when you want to use only a subset of the features or completely disconnect from the channel, respectively.

When the ChannelIO is in a sleep state, only the system push notification and event tracking via track will remain active. Real-time chat and marketing popups will not be shown.

Terminates the connection with the channel established by boot(). shutdown() disables all features including the system push notification and event tracking. If you wish to retain system push notification and event tracking capabilities, see sleep().

For example, if a user signs out from your service it is safe to shutdown() to stop receiving a system push notification.

Shows the Channel button to the Activities shown after the function is called.

The function takes effect even if it was called before boot() completes. This is because the Channel Android SDK holds “global button visibility state” and boot() does not reset the state.

Hides the Channel button.

Shows the messenger. If you have customized a channel button, you may use this function to show the messenger when the button is clicked.

Parameter

Type

Default Value

Description

activity

@NonNull Activity

Required

An Activity instance.

Hides the messenger.

Opens a chat. Note that the openChat opens a specific chat while showMessenger opens the messenger. You can not only open an existing chat but also create a new chat.

Parameter

Type

Default Value

Description

activity

@NonNullActivity

Required

An Activity instance.

chatId

@Nullable String

Required

The chat ID to open.If chat ID is null or invalid,a new chat is created.

message

@NullableString

Required

A message filled when the chat opens.It takes effect only if chatId is null.

Use openWorkflow instead.

The support bot is no longer supported and was replaced by workflow. The behavior of openSupportBot is the same as that of openWorkflow. message parameter is ignored.

Opens User chat to run a specific Support bot.

Parameter

Type

Default Value

Description

activity

@NonNull Activity

Required

An Activity instance.

supportBotId

@Nullable String

Required

This is the support bot's ID. If ID is null or invalid, chat is closed.

message

@Nullable String

Required

A message filled in input field. It takes effect only if supportBotId is valid.

Opens a user chat and starts the specified workflow.

  • openWorkflow can only be executed when the workflow trigger is set to "When starting a chat via Channel Talk."

  • If a corresponded workflow with the provided workflowId is exists, it will be executed. if workflowId is invalid, an error page is displayed.

  • If you don't pass workflowId, no action is taken.

parameter

type

required

description

workflowId

@Nullable String

X

The ID of workflow to start with. An error page will be shown if such workflow does not exist.

Tracks an event of user activities. See event tracking for details.

Parameter

Type

Default Value

Description

eventName

@NonNull String

Required

An event name.

eventProperty

@Nullable Map<String,Object>

null

An additional information of the event.

Despite its Object type, eventProperty parameter should be a type which is convertible to the JSON format, or else it might lead to a crash. In particular, avoid passing an object which contains a circular reference.

Updates user information.

Parameter

Type

Default Value

Description

userData

@NonNull UserData

Required

A user information to be updated.

callback

@Nullable UserUpdateCallback

Required

A callback to be invoked when the update completes.

Adds a tag for the user.

Parameter

Type

Default Value

Description

tags

vararg String

Required

Tags to be added.

• The maximum length is 10.

• Tag cannot be duplicated.

• Tag is case-insensitive (converted to lowercase).

• null, list including null, empty list, and empty string is not allowed.

callback

@Nullable UserUpdateCallback

null

A callback to be invoked when the update completes.

Removes user’s tag. Non-existing tags are ignored.

Parameter

Type

Default Value

Description

tags

vararg String

Required

Tags to remove.

•null, empty string, and list containing null or empty string is not allowed.

callback

@Nullable UserUpdateCallback

null

A callback to be invoked when the update completes.

Sets a page to show when an event is tracked. The default page name is the name of currently active Activity. However there might be some cases where the default page name does not fit your use case, for example if you are using Single Activity Architecture with Navigation Component, you might want to set the page to provide helpful information.

You can also set a user chat profile.

Note that the page takes effect for events sent after the setPage call. All events before the setPage call will remain intact.

Be aware that the behavior of setPage(null) and resetPage() differs. The former explicitly sets the page as null, while the latter resets the page to the default value.

Parameter

Type

Default Value

Description

page

@Nullable String

null

The page to be displayed in subsequent events.

The page will be recorded as null if page parameter is null.

profile

@Nullable Map<String, Object>

null

The user chat profile value. - When null is assigned to a specific field within the profile object, only the value of that field is cleared. - The user chat profile value is applied when a user chat is created.

Unset a page name and user chat profile set by setPage. All page in events sent onwards will be recorded as an Activity name, which is a default page value.

Hides the Channel Popup on the global screen.

Notifies the Channel Talk SDK that the Firebase Cloud Messaging(FCM) token has changed.

Parameter

Type

Default Value

Description

token

@Nullable String

Required

A FCM token.

Checks if the Channel Talk SDK is responsible for processing the push data.

Parameter

Type

Default Value

Description

payload

Map<String,String>

Required

A push data retrieved from FCM.Pass the value get by RemoteMessage#getData().

Shows a system push notification and notifies Channel Talk that a user received a push notification.

Parameter

Type

Default Value

Description

context

@NonNull Context

Required

A Context instance.

payload

Map<String,String>

Required

A push data retrieved from FCM.Pass the value get by RemoteMessage#getData().

Checks if there exists a push data passed to receivePushNotification.

Parameter

Type

Default Value

Description

context

@NonNull Activity

Required

An Activity instance.

Opens a chat according to the push data received by receivePushNotification. Call this method at the Activity which is launched when the push notification is clicked.

Checks if the latest boot succeeded and shutdown is not yet called.

Toggles the debug mode. If true, log messages will be shown.

Parameter

Type

Default Value

Description

flag

boolean

Required

A debug flag.

Sets the appearance of the SDK.

Parameter

Type

Default Value

Description

appearance

Appearance

Required

• LIGHT: Light theme

• DARK: Dark theme

• SYSTEM: Follows the system theme.