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 a list of blocked users

By creating and using a BlockedUserListQuery instance, you can retrieve a list of all or specific blocked users in your Sendbird application. The next() method returns a list of User objects that contain information about the blocked users.

// Retrieve all blocked users.
val query = SendbirdChat.createBlockedUserListQuery(BlockedUserListQueryParams())
query.next { users, e ->
    if (e != null) {
        // Handle error.
    }

    // A list of blocked users is successfully retrieved.
    // Through the list parameter of the callback handler,
    // you can access the data of each blocked user from the result list
    // that the Sendbird server has passed to the callback handler.
    // ...
}

Using the userIds filter of the BlockedUserListQuery instance, you can retrieve a list of blocked users with the specified user IDs.

// Retrieve blocked users with userIds specified in the filter.
val userIds = listOf("John", "Daniel", "Jeff")
val query = SendbirdChat.createBlockedUserListQuery(
    BlockedUserListQueryParams().apply {
        userIdsFilter = userIds
    }
)
query.next { users, e ->
    if (e != null) {
        // Handle error.
    }

    // A list of matching users is successfully retrieved.
    // ...
}