User
This section contains user Qiscus Chat SDK behavior. You can do update user profile with metadata, block user, unblock user, and get list of blocked user.
Update User Profile with Metadata
You can update user's data, for example:
QiscusCore.updateUser(username, avatarUrl, extras, new QiscusCore.SetUserListener() {
public void onSuccess(QiscusAccount qiscusAccount) {
//do anything after it successfully updated
}
public void onError(Throwable throwable) {
//do anything if error occurs
}
});
Where:
username
(string): username of its user, for display name purpose if in 1-on-1 chat roomavatarUrl
(string): a URL to display user's avatar, fallback to default avatar if not providedextras
(object, optional): metadata that can be as additional information to user, which consist key-value, for example key: position, and value: engineer.
User Authentication Checking
You can check whether a user is authenticated or not, and make sure that the user is allowed to use Qiscus Chat SDK features. When the return is true
, it means that user already authenticated, otherwise false
means user is not authenticated yet.
QiscusCore.hasSetupUser(); //boolean
Block User
You can block a user with related userId
parameter. This block user feature only works for 1-on-1 Chat Room. When a user is in the same Group or Channel with the blocked user, a user still receives messages from blocked user.
For further information you can see this link. You can also use this function by calling this method, for example:
QiscusApi.getInstance().blockUser(userId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(account -> {
// on success
}, throwable -> {
// on error
});
If you would like to enable block user feature, you can send your request to our team.
Unblock User
You can unblock a user with related userId
parameter. Unblocked user can send a message again into particular Chat Room, for example:
QiscusApi.getInstance().unblockUser(userId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(account -> {
// on success
}, throwable -> {
// on error
});
If you would like to enable block user feature, you can send your request to our team.
Get Blocked User List
You can get blocked user list with pagination, with page
parameter and you can set also the limit
number of blocked users, for example:
QiscusApi.getInstance().getBlockedUsers(page, limit)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(qiscusAccounts -> {
// on success
}, throwable -> {
// on error
});
If you would like to enable block user feature, you can send your request to our team.