val uids = ArrayList<String>()uids.add("UID1")uids.add("UID2")uids.add("UID3")CometChat.blockUsers(uids,object:CometChat.CallbackListener<HashMap<String, String>>() {override fun onSuccess(resultMap: HashMap<String, String>) { // Handle unblock users success.}override fun onError(e: CometChatException) { // Handle unblock users failure}})
In the onSuccess() callback, you receive a HashMap which contains UIDs as the keys and success or fail as the value based on whether the block operation for the UID was successful or not.
val uids = ArrayList<String>()uids.add("UID1")uids.add("UID2")uids.add("UID3")CometChat.unblockUsers(uids,object:CometChat.CallbackListener<HashMap<String, String>>() {override fun onSuccess(resultMap: HashMap<String, String>) { // Handle unblock users success.}override fun onError(e: CometChatException) { // Handle unblock users failure}})
In the onSuccess() callback, you receive a HashMap which contains UIDs as the keys and success or fail as the value based on whether the unblock operation for the UID was successful or not.
BlockedUsersRequest.DIRECTION_BLOCKED_BY_ME - Ensures that the list of blocked users only contains users blocked by the logged-in user.
BlockedUsersRequest.DIRECTION_HAS_BLOCKED_ME - Ensures that the list of blocked users only contains users that have blocked the logged-in user.
BlockedUsersRequest.DIRECTION_BOTH - Ensures the list of users includes both of the above cases. This is the default value for the direction variable if it is not set.
Java
Kotlin
BlockedUsersRequest blockedUsersRequest = new BlockedUsersRequest.BlockedUsersRequestBuilder().setDirection(BlockedUsersRequest.DIRECTION_BLOCKED_BY_ME).build();
val blockedUsersRequest = BlockedUsersRequestBuilder().setDirection(BlockedUsersRequest.DIRECTION_BLOCKED_BY_ME).build()
val blockedUsersRequest = BlockedUsersRequestBuilder().setLimit(10).build()blockedUsersRequest.fetchNext(object : CallbackListener<List<User>>() {override fun onSuccess(users: List<User>) { for (user in users) { Log.e(TAG, user.uid) }}override fun onError(e: CometChatException) { Log.e(TAG, e.message)}})