Klat
  • TalkPlus SDK
  • Android
    • Getting Started
    • Callback
    • User
      • Create User / Login
      • Update User Information
      • Block / Unblock
      • Logout
      • Delete User
    • Channel
      • Create / Delete Channel
      • View Channel
      • Updating Channel
      • Viewing Channel LIst
      • Manage Channel Members
      • Join / Leave Channel
      • Messaging
      • Hide / Show Channel
      • Freeze / Unfreeze Channel
      • Transfer Channel Ownership
      • Channel Push Notification Settings
      • Channel Member Data
    • Push Notification
    • Sample Application
    • What's New
  • iOS
    • Getting Started
    • Callback
    • User
      • Create / Login
      • Update User Information
      • Block / Unblock
      • Logout
      • Delete User
    • Channel
      • Create / Delete Channel
      • View Channel
      • Updating Channel
      • View Channel List
      • Manage Channel Members
      • Join / Leave Channel
      • Messaging
      • Hide / Show Channel
      • Freeze / Unfreeze Channel
      • Transfer Channel Ownership
      • Channel Push Notification Settings
      • Channel Member Data
    • Push Notification
    • Sample Application
    • What's New
  • Unity
    • Getting Started
    • Callback
    • User
      • Create User / Login
      • Update User Information
      • Block / Unblock
      • Logout
      • Delete User
    • Channel
      • Create / Delete Channel
      • View Channel
      • Updating Channel
      • View Channel List
      • Manage Channel Members
      • Join / Leave Channel
      • Messaging
      • Hide / Show Channel
      • Freeze / Unfreeze Channel
      • Transfer Channel Ownership
      • Channel Push Notification Settings
      • Channel Member Data
    • Push Notification
    • Sample Application
  • JavaScript
    • Getting Started
    • Realtime Event
    • Pagination
    • User
      • Create User / Login
      • Update User Information
      • Block / Unblock
      • Logout
      • Delete
    • Channel
      • Create / Delete Channel
      • View Channel
      • Updating Channel
      • View Channel List
      • Manage Channel Members
      • Join / Leave Channel
      • Messaging
      • Hide / Show Channel
      • Freeze / Unfreeze Channel
      • Transfer Channel Ownership
      • Channel Push Notification Settings
      • Channel Member Data
    • Push Notification (FCM)
    • Sample Application
    • What's New
  • Flutter
    • Getting Started
    • Callback
    • User
      • Create User / Login
      • Update User Information
      • Block / Unblock
      • Logout
      • Delete User
    • Channel
      • Create Channel
      • View Channel
      • Updating Channel
      • View Channel List
      • Manage Channel Members
      • Join / Leave Channel
      • Messaging
      • Hide / Show Channel
      • Freeze / Unfreeze Channel
      • Transfer Channel Ownership
      • Channel Push Notification Settings
      • Channel Member Data
    • Push Notification (FCM)
  • REST API
    • Getting Started
    • API
      • Users
        • Create User
        • Login (using login token)
        • View User
        • Update User
        • Activate / Deactivate
        • Enable / Disable Push Notification
        • Delete User
        • View Users
        • View Channels
        • Block / Unblock
      • Channel
        • Create Channel
        • View Channel
        • Update Channel
        • Delete Channel
        • View Channel List
        • Manage Channel Members
        • Messaging
        • Hide / Show Channel
        • Channel Freeze / Unfreeze
        • Transfer Channel Ownership
        • Channel Push Notification Settings
      • Bot
        • Create Bot
        • View Bot List
        • View Bot
        • Update Bot
        • Delete Bot
        • View Joined Channel List
        • Messaging
        • Join / Leave Channel
    • Push Notification
    • Rate Limit
  • MISC
    • Webhooks
    • SDK Rate Limit
    • Error Code
    • FAQ
      • Function
      • Spec
Powered by GitBook
On this page
  • 1. Get Blocked Users
  • 2. Block / Unblock Users
  1. Android
  2. User

Block / Unblock

1. Get Blocked Users

You can view blocked users.

The list is paginated, so to get to the next page, you can pass the last TPUser from the previous list to get to the next page.

TalkPlus.getBlockedUserList(lastUser, 
    new TalkPlus.CallbackListener<List<TPUser>>() {
        @Override
        public void onSuccess(List<TPUser> tpUsers) {
            for (TPUser tpUser : tpUsers) {
                // datetime when user was blocked
                long blockedAt = tpUser.get("blockedAt").getAsLong();
            }
        }
        @Override
        public void onFailure(int i, Exception e) {
        }
    }
);
TalkPlus.getBlockedUserList(
    lastUser, 
    object :  TalkPlus.CallbackListener<List<TPUser>>() {
        override fun onSuccess(tpUsers: List<TPUser>) {
            for (TPUser tpUser : tpUsers) {
                // datetime when user was blocked
                long blockedAt = tpUser.get("blockedAt").getAsLong();
            }
        }
        override fun onFailure(i: Int, e: Exception) { }
    }
)

2. Block / Unblock Users

You can block or unblock users.

// block
TalkPlus.blockUser(userId, new TalkPlus.CallbackListener<Void>() {
    @Override
    public void onSuccess(Void aVoid) {        
    }

    @Override
    public void onFailure(int i, Exception e) {
    }
});

// unblock
TalkPlus.unblockUser(userId, new TalkPlus.CallbackListener<Void>() {
    @Override
    public void onSuccess(Void aVoid) {
    }

    @Override
    public void onFailure(int i, Exception e) {
    }
});
// block
TalkPlus.blockUser(userId, object : TalkPlus.CallbackListener<Void>() {
    override fun onSuccess(aVoid: Void) { }
    override fun onFailure(i: Int, e: Exception) { }
})

// unblock
TalkPlus.unblockUser(userId, object : TalkPlus.CallbackListener<Void>() {
    override fun onSuccess(aVoid: Void) { }
    override fun onFailure(i: Int, e: Exception) { }
})

Please refer to the following limitations:

Whether I can add someone whom I’ve blocked to a channel that I own

X

Whether someone whom I’ve blocked can join a channel that I own

X

Whether someone whom I’ve blocked can be added as a member to a channel that I am a member of

O

Whether someone whom I’ve blocked can join a channel that I am a member of

O

Whether I can be added as a member to a channel that is owned by someone I’ve blocked

X

Whether I can join a channel that is owned by someone I’ve blocked

X

Whether I can be added as a member to a channel where someone I’ve blocked is a member of

O

Whether I can join a channel where someone I’ve blocked is a member of

O

PreviousUpdate User InformationNextLogout

Last updated 1 year ago