Before you begin
- 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.
- Configure QuickBlox SDK for your app. Check out Setup page for more details.
- Create a user session to be able to use QuickBlox functionality. See Authentication page to learn how to do it.
- Connect to the Chat server. See Connection page to learn how to do it.
Add listener
To use a contact list, you have to obtain it and set all needed listeners.- Java
- Kotlin
QBRosterListener.
Access contact list
The following function gives you access to all contact list items.- Java
- Kotlin
QBRosterEntry describes a user entity in your contact list. To get the Presence of a user, use getPresence(userID) method. Then, you can get a user’s status.
- Java
- Kotlin
Add user to your contact list
To add a user to the contact list, use the following snippet.- Java
- Kotlin
subscriptionRequested in QBSubscriptionListener. This is a request to be added to the contact list.
- Java
- Kotlin
Maximum number of contacts is 300.
Confirm the contact request
To confirm the request, usecontactsRoster.confirmSubscription() method.
- Java
- Kotlin
Reject the contact request
To reject the request, use thecontactsRoster.reject() method.
- Java
- Kotlin
Remove user from the contact list
To remove a previously added user from the contact list, use the following method.- Java
- Kotlin
Contact list updates
The above-specifiedRosterListener listener will give you all updates regarding contact list changes and users’ status updates.