Authentication
In order to use the features of Sendbird UIKit for Android in your client apps, a SendbirdUIKit
instance must be initiated in each client app through user authentication with Sendbird server. The instance communicates and interacts with the server using an authenticated user account, and is allowed to use the UIKit's features. This page explains how to authenticate your user with the server.
Connect to Sendbird server
Connect a user to Sendbird server using the SendbirdUIKit.connect()
method with the information you provided in SendbirdUIKitAdapter
. The connect()
method also automatically updates the user profile on the server.
With local caching added to Sendbird Chat SDK, the latest user instance may be returned through the callback even when the user is offline. The local caching functionality stores message and channel data in the local storage and Sendbird server. As a result, even when a user is not connected to the server, the user information stored in the local cache is returned through the callback along with an error indicating the offline status.
Refer to the code below to see how to connect a user to Sendbird server:
Note: UIKit automatically establishes a connection when necessary. If a connection with Sendbird server is required before using a UIKit component, use the
SendbirdUIKit.connect()
method to establish a connection.
Disconnect from Sendbird server
Call the SendbirdUIKit.disconnect()
method if the user requests to log out. If a user has been logged out and thus disconnected from the server, they will no longer receive messages.
Update user profile
Update a user's nickname or profile image using the SendbirdUIKit.updateUserInfo()
method.
Note: Make sure to call this method after a connection has been established.