SendbirdChat

SendbirdChat Main Class.

Types

Link copied to clipboard
object HMS

Push token related class specifically for Huawei Message Service, HMS.

Link copied to clipboard
object Options

Represents operation options.

Link copied to clipboard

PushTriggerOption of the current User. Refer to setPushTriggerOption.

Properties

Link copied to clipboard

Represents information obtained from the application settings.

Link copied to clipboard

Current application ID.

Link copied to clipboard

The option to detect if the android.app.Application is in background automatically.

Link copied to clipboard

Gets the SDK socket connection state.

Link copied to clipboard

The current connected User. null if connect is not called.

Link copied to clipboard

The key to authenticate the url retrieved from FileMessage.plainUrl, User.plainProfileImageUrl and Thumbnail.plainUrl]. This key has to be put into the HTTP header to access the url provided by above methods.

Link copied to clipboard

A flag indicating whether the SDK is initialized.

Link copied to clipboard

Whether the app uses local caching.

Link copied to clipboard

The last connected timestamp.

Link copied to clipboard

The maximum count of files that can be included in a single com.sendbird.android.message.MultipleFilesMessage.

Link copied to clipboard

The option to reconnect automatically by network awareness. It is true by default.

Link copied to clipboard

Current OS version.

Link copied to clipboard

The pending push token. null if there is no registration pending token.

Link copied to clipboard

Current SDK version.

Functions

Link copied to clipboard

Adds a channel handler. All added handlers will be notified when events occur.

Link copied to clipboard

Adds a connection handler. All added handlers will be notified when events occurs.

Link copied to clipboard
fun addExtension(key: String, version: String)

To send additional User-Agent information please set the version information. This will be set pre-defined keys only.

Link copied to clipboard
fun addFriends(userIds: List<String>, handler: UsersHandler?)

Add friends.

Link copied to clipboard

Adds a user event handler. All added handlers will be notified when events occur.

Link copied to clipboard

Sets friend discoverability of current user.

Link copied to clipboard
fun authenticate(userId: String, authToken: String? = null, handler: AuthenticationHandler?)
fun authenticate(userId: String, authToken: String? = null, apiHost: String?, handler: AuthenticationHandler?)

Authenticates to SendbirdChat with given User ID and auth token. This method is different from SendbirdChat.connect in that it doesn't create a websocket connection. This should be used in below cases: 1. If you want to use the interface provided by the FeedChannel only. 2. If you want to use chat interface prior to SendbirdChat.connect, i.e. SendbirdChat.getTotalUnreadMessageCount.

Link copied to clipboard
fun authenticateFeed(userId: String, authToken: String? = null, handler: AuthenticationHandler?)
fun authenticateFeed(userId: String, authToken: String? = null, apiHost: String?, handler: AuthenticationHandler?)

If you want to use the interface provided by the FeedChannel only, we'd recommend to authenticate using this function instead of SendbirdChat.connect.

Link copied to clipboard
fun blockUser(userToBlock: User, handler: UserHandler?)

Blocks the specified User. Blocked User cannot send messages to the blocker.

fun blockUser(userIdToBlock: String, handler: UserHandler?)

Blocks the specified User ID. Blocked User cannot send messages to the blocker.

Link copied to clipboard

Clears the db data used in local caching.

Link copied to clipboard

Clear cached messages of specific channel.

Link copied to clipboard
fun connect(userId: String, authToken: String? = null, handler: ConnectHandler?)

Connects to SendbirdChat with given User ID and auth token. If you have created Users without auth token, refer to connect or just pass auth token with null.

fun connect(userId: String, authToken: String?, apiHost: String?, wsHost: String?, handler: ConnectHandler?)

Connects to SendbirdChat with given User ID and auth token. If you have created Users without auth token, refer to connect or just pass authtoken with null.

Link copied to clipboard

Creates a query instance to get the whole User list.

Link copied to clipboard

Creates a query instance to get the banned user list from this channel.

Link copied to clipboard

Creates a query instance to get only the blocked User (by me) list.

Link copied to clipboard

Creates a query instance to get friends.

Link copied to clipboard

Creates GroupChannelCollection instance with the params.

Link copied to clipboard

Creates MessageCollection instance with the params.

Link copied to clipboard

Creates a query instance to search for a message.

Link copied to clipboard

Creates a query instance to get the muted user (online and offline both) list of the channel.

Link copied to clipboard

Creates a query instance to get FeedChannels the current User has joined.

Link copied to clipboard

Creates a query instance to get the operator list from the channel.

Link copied to clipboard

Creates a query instance to get the whole participant list (online only) of the channel.

Link copied to clipboard
Link copied to clipboard

Creates a query instance to get the poll list from the channel.

Link copied to clipboard

Creates a query instance to get the voters of a poll option.

Link copied to clipboard

Creates a query instance to get the Scheduled Message list.

Link copied to clipboard

Delete friend.

Link copied to clipboard

Delete friend discoveries.

Link copied to clipboard

Delete friend discovery.

Link copied to clipboard

Delete friends.

Link copied to clipboard

Disconnects from SendbirdChat.

Link copied to clipboard

Disconnects the websocket connection only. This does not clear the currentUser and any cached data. If you want to logout, call disconnect.

Link copied to clipboard

Requests the all emoji. The result is passed to handler.

Link copied to clipboard

Gets friend discoverability of current user.

Link copied to clipboard

Gets the size of cached data. If local caching is not used, return 0 If you want to clear all cached data, call SendbirdChat.clearCachedData If you want to clear specific channel's cache, call SendbirdChat.clearCachedMessages

Link copied to clipboard

Gets the current User's preference for GroupChannel join. If this is set as true, the User will automatically join the GroupChannel. If set as false, the User can join the GroupChannel by calling GroupChannel.acceptInvitation or decline the invitation by calling GroupChannel.declineInvitation.

Link copied to clipboard

Gets Do-not-disturb option for the current User.

Link copied to clipboard
fun getEmoji(key: String, handler: EmojiHandler?)

Requests the emoji. The result is passed to handler.

Link copied to clipboard
fun getEmojiCategory(emojiCategoryId: Long, handler: EmojiCategoryHandler?)

Requests the emoji category. The result is passed to handler.

Link copied to clipboard

Get friend changelogs by token.

Link copied to clipboard

Retrieves Global Notification channel theme.

Link copied to clipboard
fun getGroupChannelCount(myMemberStateFilter: MyMemberStateFilter?, handler: CountHandler?)

Gets the number of my GroupChannels.

Link copied to clipboard

Requests the changelogs of members of group channels the current user is joined in.

Link copied to clipboard

Requests the changelogs of members of group channels the current user is joined in.

Link copied to clipboard

Retrieves a single message template by given template key.

Link copied to clipboard

Retrieves Message template list by token

Link copied to clipboard

Requests the channel changelogs after given timestamp. The result is passed to handler.

Link copied to clipboard

Requests the channel changelogs from given token. The result is passed to handler.

Link copied to clipboard

Requests the channel changelogs after given timestamp. The result is passed to handler.

Link copied to clipboard

Requests the channel changelogs from given token. The result is passed to handler.

Link copied to clipboard

Requests push tokens of current user from given token. The result is passed to handler.

Link copied to clipboard

Retrieves Notification template

Link copied to clipboard

Retrieves Notification template list by token

Link copied to clipboard

Gets push notification sound path for the current User.

Link copied to clipboard

Gets push template option for the current User. For details of push template option, refer to setPushTemplate. This can be used, for instance, when you need to check the push notification content preview is on or off at the moment.

Link copied to clipboard

Gets the current User's push trigger option. Refer to PushTriggerOption. For details of push trigger option, refer to setPushTriggerOption.

Link copied to clipboard

Get the list of report categories.

Link copied to clipboard

Gets snooze period for the current User.

Gets the total number of unread message of GroupChannels with subscribed custom types.

Gets the number of unread message of GroupChannel with subscribed custom type.

Link copied to clipboard

Gets the subscribed total number of unread message of all GroupChannels the current user has joined.

Link copied to clipboard

Gets the number of total scheduled messages.

Link copied to clipboard
fun getTotalUnreadChannelCount(params: GroupChannelTotalUnreadChannelCountParams = GroupChannelTotalUnreadChannelCountParams(), handler: CountHandler?)

Gets the total number of unread GroupChannels the current user has joined.

Link copied to clipboard
fun getTotalUnreadMessageCount(params: GroupChannelTotalUnreadMessageCountParams = GroupChannelTotalUnreadMessageCountParams(), handler: CountHandler?)

Gets the total number of unread message of GroupChannels with GroupChannelTotalUnreadMessageCountParams filter.

Link copied to clipboard

Gets the total number of unread notifications of FeedChannel

Link copied to clipboard

Gets the unread item count of GroupChannels corresponding to GroupChannelUnreadItemCountParams.

Gets the unread item count of GroupChannels from keys.

Link copied to clipboard

Gets the subscribed total unread message of current user.

Link copied to clipboard

Initializes SendbirdChat with given InitParams.

Link copied to clipboard

Sends mark as delivered to this channel when you received push message from us.

Link copied to clipboard
fun markAsRead(channelUrls: List<String>, handler: CompletionHandler?)

Sends mark as read to joined GroupChannels. This method has rate limit. You can send one request per second. It returns SendbirdException if you exceed the rate limit.

Link copied to clipboard

Sends mark as read to all joined GroupChannels. This method has rate limit. You can send one request per second. It returns SendbirdException if you exceed the rate limit.

Link copied to clipboard

Tries reconnection with previously and successfully connected user information. This can be called in ConnectionHandler.onReconnectFailed or where you check the device network status to let the SDK try reconnection. ConnectionHandler.onReconnectStarted will be called after you call this (note that it will not be called if there is previously started connection process which has not finished), and ConnectionHandler.onReconnectFailed or ConnectionHandler.onReconnectSucceeded will be called according to the connection status afterwards.

Usually, the SDK automatically retries connection process when the network connection is lost with some backoff period. When you call this method, you can start connection process immediately.

Link copied to clipboard
Link copied to clipboard

Registers push token for the current User to receive push notification. To enable push notification and get a token, refer to Sendbird Docs.

Push token registration succeeds only when the connection (connect) is made. Otherwise, callback will return with PushTokenRegistrationStatus.PENDING status. Then you can register push token again by calling this method with pushToken which is provided by FCM as the token parameter, after the connection is done. This just adds token to the server. If you want to register this token and delete all the previous ones, refer to registerPushToken.

Registers push token for the current User to receive push notification. To enable push notification and get a token, refer to Sendbird Docs.

Push token registration succeeds only when the connection (connect) is made. Otherwise, callback will return with PushTokenRegistrationStatus.PENDING status. Then, you can register push token again by calling registerPushToken after the connection is done.

Link copied to clipboard

Removes all channel handlers added by addChannelHandler.

Link copied to clipboard

Removes all connection handlers added by addConnectionHandler.

Link copied to clipboard

Removes all user event handlers added by addUserEventHandler.

Link copied to clipboard

Removes a channel handler. The deleted handler no longer be notified.

Link copied to clipboard

Removes a connection handler. The deleted handler no longer be notified.

Link copied to clipboard

Removes a user event handler. The deleted handler no longer be notified.

Link copied to clipboard

Sets the current User's preference for GroupChannel join. If this is set as true, the User will automatically join the GroupChannel. If set as false, the User can join the GroupChannel by calling GroupChannel.acceptInvitation or decline the invitation by calling GroupChannel.declineInvitation.

Link copied to clipboard
fun setDoNotDisturb(doNotDisturbOn: Boolean, startHour: Int, startMin: Int, endHour: Int, endMin: Int, timezone: String, handler: CompletionHandler?)

Sets Do-not-disturb option for the current User. If this option is enabled, the current User does not receive push notification during the specified time repeatedly. If you want to snooze specific period, use setSnoozePeriod.

Link copied to clipboard

Sets the push notification sound file path for the current User. This setting will be delivered on push notification payload.

Link copied to clipboard
fun setPushTemplate(templateName: String, handler: CompletionHandler?)

Sets push template option for the current User. The only valid arguments for template name are PUSH_TEMPLATE_DEFAULT and PUSH_TEMPLATE_ALTERNATIVE. If PUSH_TEMPLATE_DEFAULT is set, the push notification will contain the original message in the message field of the push notification. If PUSH_TEMPLATE_ALTERNATIVE is set, message of push notification will be replaced by the content you've set on SendbirdChat Dashboard.

Link copied to clipboard

Sets the current User's push trigger option. If certain channel's push trigger option is set to GroupChannel.PushTriggerOption.DEFAULT, it works according to the state of PushTriggerOption. If not, push messages will be triggered according to the state of GroupChannel.PushTriggerOption. Refer to GroupChannel.PushTriggerOption.

Link copied to clipboard

Set a SessionHandler which is required for SDK refresh the session when the current session expires.

Link copied to clipboard
fun setSnoozePeriod(snoozeOn: Boolean, startTs: Long, endTs: Long, handler: CompletionHandler?)

Sets snooze period for the current User. If this option is enabled, the current User does not receive push notification during the given period. It's not a repetitive operation. If you want to snooze repeatedly, use setDoNotDisturb.

Link copied to clipboard
fun unblockUser(blockedUser: User, handler: CompletionHandler?)

Unblocks the specified User. Unblocked User can send messages to the ex-blocker.

fun unblockUser(blockedUserId: String, handler: CompletionHandler?)

Unblocks the specified User ID. Unblocked User cannot send messages to the ex-blocker.

Link copied to clipboard

Unregisters push token for the current User.

Link copied to clipboard

Unregisters all push token bound to the current User.

Link copied to clipboard

Updates current User's information.

fun updateCurrentUserInfo(preferredLanguages: List<String>, handler: CompletionHandler?)

Updates current User's preferred language.