QuickBlox Documentation

QuickBlox provides powerful Chat API and SDK to add real-time messaging and video calls to your web and mobile apps. Learn how to integrate QuickBlox across multiple platforms.

Users

Learn how to manage your users with QuickBlox.

The user module manages all things related to user accounts handling, authentication, account data, password remind, etc.

Visit our Key Concepts page to get an overall understanding of the most important QuickBlox concepts.

Before you begin

  1. Register a QuickBlox account. This is a matter of a few minutes and you will be able to use this account to build your apps.
  2. Configure QuickBlox SDK for your app. Check out our Setup page for more details.
  3. Create a user session to be able to use QuickBlox functionality. See our Authentication page to learn how to do it.

Create user

Create a user using the code snippet below. Only login (or email) and password are required. Other fields are optional.

QBUser user = new QBUser();
user.setLogin("johnsmith");
user.setPassword("johnPassword");
        
QBUsers.signUp(newUser).performAsync(new QBEntityCallback<QBUser>() {
    @Override
    public void onSuccess(QBUser user, Bundle bundle) {
      
    }

    @Override
    public void onError(QBResponseException e) {
                
    }
});
val user = QBUser()
user.login = "johnsmith"
user.password = "johnPassword"

QBUsers.signUp(user).performAsync(object : QBEntityCallback<QBUser> {
    override fun onSuccess(qbUser: QBUser?, bundle: Bundle?) {
        
    }

    override fun onError(e: QBResponseException? {
        
    }
})

Retrieve users

Get a list of users using the getUsers() method. The code snippet below shows how to get a list of users created between the two given dates, and sorted in descending order.

String field = "created_at";
String typeField = "date";
String sortDesc = "desc";
String sortAsc = "asc";
String paramSort = "order";
String paramFilter = "filter[]";
String searchOperator = "between";
String searchValue = "2021-01-01, 2021-05-06";

ArrayList<GenericQueryRule> rules = new ArrayList<GenericQueryRule>();
rules.add(new GenericQueryRule(paramSort, sortDesc + " " + typeField + " " + field));
rules.add(new GenericQueryRule(paramFilter, typeField + " " + field + " " + searchOperator + " " + searchValue));

QBPagedRequestBuilder requestBuilder = new QBPagedRequestBuilder();
requestBuilder.setRules(rules);
requestBuilder.setPerPage(100);
requestBuilder.setPage(1);

QBUsers.getUsers(requestBuilder).performAsync(new QBEntityCallback<ArrayList<QBUser>>() {
    @Override
    public void onSuccess(ArrayList<QBUser> usersList, Bundle params) {
      
    }
  
    @Override
    public void onError(QBResponseException exception) {
      
    }
});
val field = "created_at"
val typeField = "date"
val sortDesc = "desc"
val sortAsc = "asc"
val paramSort = "order"
val paramFilter ="filter[]"
val searchOperator = "between"
val searchValue = "2021-01-01, 2021-05-06"
  
val rules = ArrayList<GenericQueryRule>()
rules.add(GenericQueryRule(paramSort, "$sortDesc $typeField $field"))
rules.add(GenericQueryRule(paramFilter,"$typeField $field $searchOperator $searchValue"))

val requestBuilder = QBPagedRequestBuilder()
requestBuilder.rules = rules
requestBuilder.perPage = 100
requestBuilder.page = 1

QBUsers.getUsers(requestBuilder).performAsync(object : QBEntityCallback<ArrayList<QBUser>> {
    override fun onSuccess(usersList: ArrayList<QBUser>, params: Bundle) {
        
    }

    override fun onError(exceptione: QBResponseException) {
       
    }
})

Argument

Required

Description

requestBuilder

yes

Allows to set parameters for the request.

If you want to retrieve only users updated after some specific date time and order search results, you can use operators. This is useful if you cache users somehow and do not want to obtain the whole list of users on every app start. Thus, you can use search and sort operators to list users on the page so that it is easier to see specific users.

If you want to get a paginated list of users from the server, you can set the following fields in the QBPagedRequestBuilder class:

Field

Required

Description

perPage

no

Number of records to return in one page.

page

no

Number of pages with results to be returned.

Search operators

You can use search operators to get more specific search results. The code snippet below shows how to get a list of users filtered by the created_at field and created between the two given dates.

String field = "created_at";
String typeField = "date";
String paramFilter = "filter[]";
String searchOperator = "between";
String searchValue = "2021-01-01, 2021-05-06";

ArrayList<GenericQueryRule> rules = new ArrayList<GenericQueryRule>();
rules.add(new GenericQueryRule(paramFilter, typeField + " " + field + " " + searchOperator + " " + searchValue));

QBPagedRequestBuilder requestBuilder = new QBPagedRequestBuilder();
requestBuilder.setRules(rules);

QBUsers.getUsers(requestBuilder).performAsync(new QBEntityCallback<ArrayList<QBUser>>() {
    @Override
    public void onSuccess(ArrayList<QBUser> usersList, Bundle params) {
      
    }
  
    @Override
    public void onError(QBResponseException exception) {
      
    }
});
val field = "created_at"
val typeField = "date"
val paramFilter ="filter[]"
val searchOperator = "between"
val searchValue = "2021-01-01, 2021-05-06"
  
val rules = ArrayList<GenericQueryRule>()
rules.add(GenericQueryRule(paramFilter,"$typeField $field $searchOperator $searchValue"))

val requestBuilder = QBPagedRequestBuilder()
requestBuilder.rules = rules

QBUsers.getUsers(requestBuilder).performAsync(object : QBEntityCallback<ArrayList<QBUser>> {
    override fun onSuccess(usersList: ArrayList<QBUser>, params: Bundle) {
        
    }

    override fun onError(exceptione: QBResponseException) {
       
    }
})

Here are the search operators you can use to search for the exact data that you need.

Search operators

Applicable to types

Applicable to fields

Description

lt

number, string, date

id, created_at, updated_at, last_request_at, external_user_id, facebook_id

Less Than operator.

gt

number, string, date

id, created_at, updated_at, last_request_at, external_user_id, facebook_id

Greater Than operator.

gte

number, string, date

id, created_at, updated_at, last_request_at, external_user_id, facebook_id

Greater Than or Equal to operator.

le

number, string, date

id, created_at, updated_at, last_request_at, external_user_id, facebook_id

Less or Equal to operator

eq

number, string, date

id, full_name, email, login, phone, created_at, updated_at, last_request_at, external_user_id, facebook_id

Equal to operator.

ne

number, string, date

id, full_name, email, login, phone, created_at, updated_at, last_request_at, external_user_id, facebook_id

Not Equal to operator.

between

number, string, date

id, created_at, updated_at, last_request_at, external_user_id, facebook_id

Contained between values operator.

in

number, string, date

id, full_name, email, login, phone, created_at, updated_at, last_request_at, external_user_id, facebook_id

IN array operator.

Sort operators

You can use sort operators to order the search results. The request below will return users by the created_at field sorted in descending order.

String field = "created_at";
String typeField = "date";
String sortDesc = "desc";
String paramSort = "order";

ArrayList<GenericQueryRule> rules = new ArrayList<GenericQueryRule>();
rules.add(new GenericQueryRule(paramSort, sortDesc + " " + typeField + " " + field));

QBPagedRequestBuilder requestBuilder = new QBPagedRequestBuilder();
requestBuilder.setRules(rules);

QBUsers.getUsers(requestBuilder).performAsync(new QBEntityCallback<ArrayList<QBUser>>() {
    @Override
    public void onSuccess(ArrayList<QBUser> usersList, Bundle params) {
      
    }
  
    @Override
    public void onError(QBResponseException exception) {
      
    }
});
val field = "created_at"
val typeField = "date"
val sortDesc = "desc"
val paramSort = "order"
  
val rules = ArrayList<GenericQueryRule>()
rules.add(GenericQueryRule(paramSort, "$sortDesc $typeField $field"))

val requestBuilder = QBPagedRequestBuilder()
requestBuilder.rules = rules

QBUsers.getUsers(requestBuilder).performAsync(object : QBEntityCallback<ArrayList<QBUser>> {
    override fun onSuccess(usersList: ArrayList<QBUser>, params: Bundle) {
        
    }

    override fun onError(exceptione: QBResponseException) {
       
    }
})

Here are the sort operators you can use to order the search results.

Sort operator

Applicable to types

Applicable to fields

Description

sortAsc

All types

id, full_name, email, login, phone, website, created_at, updated_at,
last_request_at, external_user_id

Search results will be sorted in ascending order by the specified field.

sortDesc

All types

id, full_name, email, login, phone, website, created_at, updated_at,
last_request_at, external_user_id

Search results will be sorted in descending order by the specified field.

Retrieve users by ID

To get a list of users by ID for a current account, use the following code snippet.

QBPagedRequestBuilder pagedRequestBuilder = new QBPagedRequestBuilder();
pagedRequestBuilder.setPage(1);
pagedRequestBuilder.setPerPage(50);

ArrayList<Integer> usersIDs = new ArrayList<>();
usersIDs.add(123);
usersIDs.add(234);
usersIDs.add(345);
usersIDs.add(456);

QBUsers.getUsersByIDs(usersIDs, pagedRequestBuilder).performAsync(new QBEntityCallback<ArrayList<QBUser>>() {
    @Override
    public void onSuccess(ArrayList<QBUser> qbUsers, Bundle bundle) {
        
    }

    @Override
    public void onError(QBResponseException e) {

    }
});
val pagedRequestBuilder = QBPagedRequestBuilder()
pagedRequestBuilder.page = 1
pagedRequestBuilder.perPage = 50

val usersIDs = ArrayList<Int>()
usersIDs.add(123)
usersIDs.add(234)
usersIDs.add(345)
usersIDs.add(456)

QBUsers.getUsersByIDs(usersIDs, pagedRequestBuilder).performAsync(object : QBEntityCallback<ArrayList<QBUser>> {
    override fun onSuccess(qbUsers: ArrayList<QBUser>?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException?) {

    }
})

Or, you can retrieve a single user if needed.

QBUsers.getUser(qbUser.getId()).performAsync(new QBEntityCallback<QBUser>() {
    @Override
    public void onSuccess(QBUser qbUser, Bundle bundle) {

    }

    @Override
    public void onError(QBResponseException e) {

    }
});
QBUsers.getUser(qbUser.id).performAsync(object : QBEntityCallback<QBUser> {
    override fun onSuccess(qbUser: QBUser?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException?) {

    }
})

Retrieve user by login

To get a list of users by login for a current account, use the following code snippet.

String userLogin = qbUser.getLogin();
QBUsers.getUserByLogin(userLogin).performAsync(new QBEntityCallback<QBUser>() {
    @Override
    public void onSuccess(QBUser qbUser, Bundle bundle) {
        
    }

    @Override
    public void onError(QBResponseException e) {

    }
});
val userLogin = qbUser.login
QBUsers.getUserByLogin(userLogin).performAsync(object : QBEntityCallback<QBUser> {
    override fun onSuccess(qbUser: QBUser?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException? {

    }
})

Retrieve user by email

To get a list of users by email for a current account, use the following code snippet.

String usersEmail = qbUser.getEmail();
QBUsers.getUserByEmail(usersEmail).performAsync(new QBEntityCallback<QBUser>() {
    @Override
    public void onSuccess(QBUser qbUser, Bundle bundle) {
        
    }

    @Override
    public void onError(QBResponseException e) {

    }
});
val usersEmail = qbUser.email
QBUsers.getUserByEmail(usersEmail).performAsync(object : QBEntityCallback<QBUser> {
    override fun onSuccess(qbUser: QBUser?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException?) {

    }
})

Retrieve users by full name

To get a list of users found by the server according to the search query, use the following code snippet.

QBPagedRequestBuilder pagedRequestBuilder = new QBPagedRequestBuilder();
pagedRequestBuilder.setPage(1);
pagedRequestBuilder.setPerPage(50);

QBUsers.getUsersByFullName(searchQuery, pagedRequestBuilder).performAsync(new QBEntityCallback<ArrayList<QBUser>>() {
    @Override
    public void onSuccess(ArrayList<QBUser> qbUsers, Bundle bundle) {
        
    }

    @Override
    public void onError(QBResponseException e) {

    }
});
val pagedRequestBuilder = QBPagedRequestBuilder()
pagedRequestBuilder.page = 1
pagedRequestBuilder.perPage = 50

QBUsers.getUsersByFullName(searchQuery, pagedRequestBuilder).performAsync(object : QBEntityCallback<ArrayList<QBUser>> {
    override fun onSuccess(qbUsers: ArrayList<QBUser>?, bundle: Bundle?) {
    }

    override fun onError(e: QBResponseException?) {
    }
})

Retrieve users by phone number

To get a list of users by phone number for a current account, use the following code snippet.

QBPagedRequestBuilder pagedRequestBuilder = new QBPagedRequestBuilder();
pagedRequestBuilder.setPage(1);
pagedRequestBuilder.setPerPage(50);

ArrayList<String> phoneNumbers = new ArrayList<>();
phoneNumbers.add("+380552223344");
phoneNumbers.add("+190229996677");
phoneNumbers.add("78088800444");

QBUsers.getUsersByPhoneNumbers(phoneNumbers, pagedRequestBuilder).performAsync(new QBEntityCallback<ArrayList<QBUser>>() {
    @Override
    public void onSuccess(ArrayList<QBUser> qbUsers, Bundle bundle) {
        
    }

    @Override
    public void onError(QBResponseException e) {

    }
});
val pagedRequestBuilder = QBPagedRequestBuilder()
pagedRequestBuilder.page = 1
pagedRequestBuilder.perPage = 50

val phoneNumbers = ArrayList<String>()
phoneNumbers.add("+380552223344")
phoneNumbers.add("+190229996677")
phoneNumbers.add("78088800444")

QBUsers.getUsersByPhoneNumbers(phoneNumbers, pagedRequestBuilder).performAsync(object : QBEntityCallback<ArrayList<QBUser>> {
    override fun onSuccess(qbUsers: ArrayList<QBUser>?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException?) {

    }
})

Retrieve user by external user ID

If you have your own database with users (we call these databases as "external databases"), you can use External User IDExternal User ID - a unique identifier of the user in the integrated external system; used for cross-referencing. For example, a user has an internal user ID within the QuickBlox system and external ID, provided by the integrated external (client) system. When an API call with reference to the user has to be submitted, the user can be referenced by either internal or external identifiers. (ExternalID field) in QBUser model to link users from QuickBlox with users from your external database.

QBUsers.getUserByExternalId(qbUser.getExternalId()).performAsync(new QBEntityCallback<QBUser>() {
    @Override
    public void onSuccess(QBUser qbUser, Bundle bundle) {

    }

    @Override
    public void onError(QBResponseException e) {

    }
});
QBUsers.getUserByExternalId(qbUser.externalId).performAsync(object : QBEntityCallback<QBUser> {
    override fun onSuccess(qbUser: QBUser?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException?) {

    }
})

Retrieve users by Facebook ID

To get a list of users by Facebook ID for a current account, use the following code snippet.

QBUsers.getUserByFacebookId(qbUser.getFacebookId()).performAsync(new QBEntityCallback<QBUser>() {
    @Override
    public void onSuccess(QBUser qbUser, Bundle bundle) {

    }

    @Override
    public void onError(QBResponseException e) {

    }
});
QBUsers.getUserByFacebookId(qbUser.facebookId).performAsync(object : QBEntityCallback<QBUser> {
    override fun onSuccess(qbUser: QBUser?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException?) {

    }
})

Or, if you want to retrieve several users by Facebook IDs, use the following code lines.

ArrayList<String> facebookIDs = new ArrayList<>();
facebookIDs.add("552223344");
facebookIDs.add("90229996677");
facebookIDs.add("78088800444");

QBPagedRequestBuilder pagedRequestBuilder = new QBPagedRequestBuilder();
pagedRequestBuilder.setPage(1);
pagedRequestBuilder.setPerPage(50);

QBUsers.getUsersByFacebookId(facebookIDs, pagedRequestBuilder).performAsync(new QBEntityCallback<ArrayList<QBUser>>() {
    @Override
    public void onSuccess(ArrayList<QBUser> qbUsers, Bundle bundle) {
        
    }

    @Override
    public void onError(QBResponseException e) {

    }
});
val facebookIDs = ArrayList<String>()
facebookIDs.add("552223344")
facebookIDs.add("90229996677")
facebookIDs.add("78088800444")
  
val pagedRequestBuilder = QBPagedRequestBuilder()
pagedRequestBuilder.page = 1
pagedRequestBuilder.perPage = 50

QBUsers.getUsersByFacebookId(facebookIDs, pagedRequestBuilder).performAsync(object : QBEntityCallback<ArrayList<QBUser>> {
    override fun onSuccess(qbUsers: ArrayList<QBUser>?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException?) {

    }
})

Retrieve users by tags

To get a list of users by tags for a current account, use the following code snippet.

QBPagedRequestBuilder pagedRequestBuilder = new QBPagedRequestBuilder();
pagedRequestBuilder.setPage(1);
pagedRequestBuilder.setPerPage(50);
 
ArrayList<String> tags = new ArrayList<>();
tags.add("doctor");
tags.add("english");
tags.add("francias");

QBUsers.getUsersByTags(tags, pagedRequestBuilder).performAsync(new QBEntityCallback<ArrayList<QBUser>>() {
    @Override
    public void onSuccess(ArrayList<QBUser> qbUsers, Bundle bundle) {

    }

    @Override
    public void onError(QBResponseException e) {

    }
});
val pagedRequestBuilder = QBPagedRequestBuilder()
pagedRequestBuilder.page = 1
pagedRequestBuilder.perPage = 50
  
val tags = ArrayList<String>()
tags.add("doctor")
tags.add("english")
tags.add("francias")

QBUsers.getUsersByTags(tags, pagedRequestBuilder).performAsync(object : QBEntityCallback<ArrayList<QBUser>> {
    override fun onSuccess(qbUsers: ArrayList<QBUser>?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException?) {

    }
})

Delete user

A user can delete himself from the platform.

QBUsers.deleteUser(qbUser.getId()).performAsync(new QBEntityCallback<Void>() {
    @Override
    public void onSuccess(Void aVoid, Bundle bundle) {

    }

    @Override
    public void onError(QBResponseException e) {

    }
});
QBUsers.deleteUser(qbUser.id).performAsync(object : QBEntityCallback<Void> {
    override fun onSuccess(aVoid: Void?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException?) {

    }
})

Reset user password

It's possible to reset a password via email.

QBUsers.resetPassword(qbUser.getEmail()).performAsync(new QBEntityCallback<Void>() {
    @Override
    public void onSuccess(Void aVoid, Bundle bundle) {

    }

    @Override
    public void onError(QBResponseException e) {

    }
});
QBUsers.resetPassword(qbUser.email).performAsync(object : QBEntityCallback<Void> {
    override fun onSuccess(aVoid: Void?, bundle: Bundle?) {

    }

    override fun onError(e: QBResponseException?) {

    }
})

🚧

Make sure to enable the email confirmation. This functionality allows application users to confirm their emails. If a user doesn't confirm the email, the emails won't be sent to this user. As a result, a password reset functionality won't work. To enable the email confirmation, proceed as follows:

  1. Go to the Dashboard => YOUR_APP => Users => Settings => User registration confirmation and check the box.
  2. Click the Save button.

📘

By default, password reset functionality is turned off for Basic, Startup and Growth plans. Contact the sales team.

Update user

Update a user profile by calling the updateUser() method. If you want to change your password, you need to provide 2 parameters: password and newPassword. The updated user entity will be returned.

🚧

You must set null into the user's password field if you do not want to change your password. Otherwise, you will need to add the user's old password to the oldPassword field.

You can update any other field of the user using the updateUser() method. Thus, the snippet below shows how to update a tagList and customData fields.

// set user's tag or tags
StringifyArrayList<String> userTags = new StringifyArrayList<>();
userTags.add("tagOne");
userTags.add("tagTwo");

user.setTags(userTags);

// set user's custom data
JSONObject jsonObject = new JSONObject();
try {
    jsonObject.put("name", "John");
    jsonObject.put("age", 31);
    jsonObject.put("city", "New York");
} catch (JSONException e) {
    
}

user.setCustomData(jsonObject.toString());

QBUsers.updateUser(user).performAsync(new QBEntityCallback<QBUser>() {
    @Override
    public void onSuccess(QBUser qbUser, Bundle bundle) {
        
    }

    @Override
    public void onError(QBResponseException e) {
        
    }
});
// set user's tag or tags
val userTags = StringifyArrayList<String>()
userTags.add("tagOne")
userTags.add("tagTwo")

user.tags = userTags

// set user's custom data
val jsonObject = JSONObject()
try {
    jsonObject.put("name", "John")
    jsonObject.put("age", 31)
    jsonObject.put("city", "New York")
} catch (e: JSONException) {
  
}

user.setCustomData(jsonObject.toString())
        
QBUsers.updateUser(user).performAsync(object : QBEntityCallback<QBUser> {
    override fun onSuccess(qbUser: QBUser?, bundle: Bundle?) {
        
    }

    override fun onError(e: QBResponseException?) {
        
    }
})

Field

Required

Description

tags

no

User tags. An array of Strings. A tag must include alphanumeric characters only and start with a letter. The tag must be at least 3 and no more than 15 characters long. There are no spaces in the tag format. For example, the "tagOne" format is correct while the "tag one" format is incorrect.

If more that 10 tags are provided, an error is returned: tag list should contain maximum 10 tags.

customData

no

User custom data. Should be a String. You can convert any data types to String, for example, JSON, XML , etc.

Set user avatar

To set a user avatar, just create and upload a file to the QuickBlox cloud storage and connect it to the user.

To create a file to QuickBlox cloud storage, you should overwrite the file from the device file system to a java.io.File and then write it to the avatar. Then, upload the file to the QuickBlox cloud storage by calling the uploadFileTask() method and passing the avatar to it. Now that the file is uploaded, get the ID of the uploaded file. See this section to learn more about file upload functionality in details.

To connect the file to the user, set the ID of the uploaded file to the fileId field of the user and call the updateUser() method. As a result, the user avatar gets updated.

private void setAvatar() {
    // Just as example for User model
    final QBUser user = new QBUser();
    user.setId(123);
 
    String tags = null; 
  
    // Create file
    File avatar = new File("path to file");
    // Some logic for write file by OutputStream and InputStream.
  
    // Upload file to the server
    boolean fileIsPublic = false;

    QBContent.uploadFileTask(avatar, fileIsPublic, tags, new QBProgressCallback() {
        @Override
        public void onProgressUpdate(int i) {
        // do something to show progress if needed
        }
    }).performAsync(new QBEntityCallback<QBFile>() {
        @Override
        public void onSuccess(QBFile qbFile, Bundle bundle) {
            int uploadedFileID = qbFile.getId();
        
            // Add File to User
            user.setFileId(uploadedFileID);
            updateUser(user);
        }

        @Override
        public void onError(QBResponseException e) {

        }
    });
}

private void updateUser(QBUser user) {
    QBUsers.updateUser(user).performAsync(new QBEntityCallback<QBUser>() {
        @Override
        public void onSuccess(QBUser qbUser, Bundle bundle) {

        }

        @Override
        public void onError(QBResponseException e) {

        }
    });
}
private fun setAvatar() {
    // Just as example for User model
    val user = QBUser()
    user.id = 123
    
    val tags:String? = null
      
    // Create file
    val avatar = File("path to file")
    // Some logic for write file by OutputStream and InputStream.
   
    // Upload file to the server
    val fileIsPublic = false

    QBContent.uploadFileTask(avatar, fileIsPublic, tags) {
        // do something to show progress if needed
    }.performAsync(object : QBEntityCallback<QBFile> {
        override fun onSuccess(qbFile: QBFile?, bundle: Bundle?) {
            val uploadedFileID = qbFile?.id

            // Add File to User
            user.fileId = uploadedFileID
            updateUser(user)
        }

        override fun onError(e: QBResponseException?) {

        }
    })
}

fun updateUser(user : QBUser) {
    QBUsers.updateUser(user).performAsync(object : QBEntityCallback<QBUser> {
        override fun onSuccess(qbUser: QBUser?, bundle: Bundle?) {

        }

        override fun onError(e: QBResponseException?) {

        }
    })
}

Pass the following arguments to the updateUser() method:

Argument

Required

Description

user

yes

Specifies user fields that should be set.

Now, other users can get your avatar by calling the downloadFileById() method.

int userAvatarID = user.getFileId();
QBContent.downloadFileById(userAvatarID, new QBProgressCallback() {
    @Override
    public void onProgressUpdate(int i) {
        // do something to show progress if needed
    }
}).performAsync(new QBEntityCallback<InputStream>() {
    @Override
    public void onSuccess(InputStream inputStream, Bundle bundle) {
        // Receiving input stream
        // Just write an InputStream to a file and show it
    }

    @Override
    public void onError(QBResponseException e) {

    }
});
val userAvatarID = user.fileId!!
QBContent.downloadFileById(userAvatarID) {
    // do something to show progress if needed
}.performAsync(object : QBEntityCallback<InputStream> {
    override fun onSuccess(inputStream: InputStream?, bundle: Bundle?) {
        // Receiving input stream
        // Just write an InputStream to a file and show it
    }

    override fun onError(e: QBResponseException?) {

    }
})

Argument

Required

Descriotion

userAvatarID

yes

File unique identifier.

Updated 26 days ago


What's Next

Chat

Users


Learn how to manage your users with QuickBlox.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.