/ SDKs / Android
SDKs
Chat SDKs Android v4
Chat SDKs Android
Chat SDKs
Android
Version 4

Retrieve the online status of a user

Copy link

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.
    }
}