Chat / Android
Chat Android v4
Chat Android
Chat
Android
Home
/
Chat
/
Android
/
User
This is the new Docs for Chat SDK v4 for Android. To see the previous Docs, click here.

Retrieve the online status of a user

You can check if a user in the Sendbird application is currently connected to the Sendbird server. For group channels only, you can check whether each member is currently connected to the server.

val userIds = listOf("Jeff")
val query = SendbirdChat.createBlockedUserListQuery(
    BlockedUserListQueryParams().apply {
        userIdsFilter = userIds
    }
)
query.next { users, e ->
    if (e != null) {
        // Handle error.
    }

    // users?.first() = "Jeff"
    if (users?.first()?.connectionStatus == User.ConnectionStatus.ONLINE) {
        // "Jeff" is currently online.
        // User.ConnectionStatus consists of ONLINE and OFFLINE.
    }
}