Show the chat

This guide instructs you on how to show your chat app.

Check chat availability

Note:

Before showing the chat make sure you have initialized this SDK and executed the setIdentity method.

To check if the chat is available, use the following method:

Copy
Copied
// Possible errors:
// - sdk_not_initialized - means that you need to perform `initialize` method firstly and then `setIdentity`.
// - chat_already_started - means that you cannot have two chats opened.

fun isChatAvailable(): Result<Unit>

Display the Chat app

To start the chat, use the start method in SinchChatSDK.chat.*:

Copy
Copied
fun start(context: Context): Result<Unit>

The result will return information if the chat was shown correctly:

Copy
Copied
do {

val result = SinchChatSDK.chat.start(this)
if (result.isFailure) {
   // do some things.
}

You may now set up push notifications, if desired.

We'd love to hear from you!
Rate this content:
Still have a question?
 
Ask the community.