Skip to main content
Directions: BLOCKED_BY_ME | HAS_BLOCKED_ME | BOTH (default)
Blocking a user prevents all communication between them and the logged-in user — messages, calls, and presence updates are all suppressed. You can block and unblock users by UID, and fetch the blocked users list with filtering and pagination.

Block Users

Block users to prevent all communication with them. Use blockUsers() with an array of UIDs.
Returns an object with UIDs as keys and "success" or "fail" as values. Each User in the request is processed independently.

Unblock Users

Unblock previously blocked users using unblockUsers() with an array of UIDs.
Returns an object with UIDs as keys and "success" or "fail" as values. Each User in the request is processed independently.

Get List of Blocked Users

Use BlockedUsersRequestBuilder to fetch blocked users with filtering and pagination.

Set Limit

Sets the number of blocked users to fetch per request.

Set Search Keyword

With offline support on, this filter is answered by the server only; the cached page is empty.
Filters blocked users by a search string.

Set Direction

Filters by block direction:
  • BLOCKED_BY_ME — Users blocked by the logged-in user
  • HAS_BLOCKED_ME — Users who have blocked the logged-in user
  • BOTH — Both directions (default)
After configuring the builder, call build() to get the BlockedUsersRequest object, then call fetchNext() to retrieve blocked users.
The fetchNext() method returns an array of User objects representing blocked users. Relevant fields to access on returned users:

Offline Behaviour

With offline support enabled, passing a UserFetchListener to BlockedUsersRequest.fetchNext() calls onCachedUsers first from the SDK’s own blocked-users list. The SDK refreshes that list when the user logs in and after a reconnect sync once the last refresh is more than 12 hours old, and it updates the list when you call blockUsers() or unblockUsers(). Then onServerUsers delivers the live page to reconcile by uid; the server page is not saved to the device. The cached page is empty when no users are blocked or when setSearchKeyword is set. Offline, the read ends with onError (FAILED_TO_FETCH) after the cached page, and the Promise rejects. See Show Cached Data.

Next Steps

Retrieve Users

Fetch and filter user lists

User Presence

Track online/offline status of users

User Management

Create, update, and delete users

Flag Message

Report inappropriate messages from users