Title
Create new category
Edit page index title
Edit category
Edit link
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() { @Override public void onSuccess(QiscusAccount qiscusAccount) { //do anything after it successfully updated } @Override public void onError(Throwable throwable) { //do anything if error occurs } });Where:
- username: user name of its user to display user's name in the 1-on-1 Chat Room,
- avatarUrl: Url to display user's avatar, fallback to default avatar if not provided,
- extras: 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(); //booleanBlock 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.
Get List of All Users
You can get list of users within your App ID. You need to pass page, limit, and query. This query means the username that you are looking for. For example: "John". For the implementation you can refer this code below:
QiscusApi.getInstance().getUsers(page, limit, query) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(qiscusAccounts -> { // on success }, throwable -> { // on error });Qiscus Technology