Class
| ZIM | ZIMAudio |
| ZIMAudioEventHandler | ZIMEventHandler |
| ZPNsManager | ZPNsMessageReceiver |
ZIM
Details
ZIM SDK main class.
Declared in ZIM.java
Methods
create
ZIM create(long appID, Application application)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| appID | long | Application ID issued by ZEGO for developers, please contact ZEGO technical support to apply. |
| application | Application | Android application context. |
- Platform differences: When calling this function under the Android platform, in addition to the appID, the Application class object must also be passed in.
Return
ZIM instance.
create
ZIM create(ZIMAppConfig appConfig, Application application)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| appConfig | ZIMAppConfig | AppID and appSign issued by ZEGO for developers, Please apply at the ZEGO console. |
| application | Application | Android application context. |
- When to call: Before calling other member functions, you must call this API to create a ZIM example.
Usage restrictions: Currently only one instance is supported, repeated calls will return [null].
Precautions:
-
Currently, the [create] function can only create one instance at most. If it is called multiple times, only the first one will return a valid instance, and the rest will be [null]. The developer should save the ZIM instance by himself, and ensure that the life cycle of the instance is available in the process of using the ZIM business function; or after calling [create], he can use [getInstance] to obtain its singleton object and call other member functions.
-
If you use this function to create an instance, you must pass in both AppID and AppSign (exclude Web platform).
Scope of Impact: Failure to call this function will prevent other member functions from being called.
Platform difference: When calling this function on the Android platform, in addition to the appID, the Application class object must also be passed in.
Return
ZIM instance.
getVersion
String getVersion()ZIM.javaGet the SDK version.
- Use cases: 1. When the SDK is running, the developer finds that it does not match the expected situation and submits the problem and related logs to the ZEGO technical staff for locating. The ZEGO technical staff may need the information of the engine version to assist in locating the problem.
- Developers can also collect this information as the version information of the engine used by the app, so that the SDK corresponding to each version of the app on the line.
When to call : It can be called at any time.
- Available since: 1.1.0.
SDK version.
getInstance
ZIM getInstance()ZIM.java- When to call: You must call [create] to create an instance before calling this function to obtain a singleton object, otherwise it will return [null].
Related interface: [create].
setLogConfig
void setLogConfig(ZIMLogConfig config)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMLogConfig | Log configuration object. |
- Default value: /storage/Android/data/[Application ID]/files/ZIMLogs
- When to call: It must be called before [create].
If the developer calls after [create], the SDK will save this configuration until the next time [create] takes effect.
Life cycle: Set before calling [create], and take effect when calling [create]. If the developer does not set a new log configuration in the next [create], the previous configuration will still take effect.
Platform difference: The default path of different platforms is different, please refer to the default value.
Related reference: For details, please refer to https://doc-zh.zego.im/faq/IM_sdkLog?product=IM&platform=all.
setGeofencingConfig
boolean setGeofencingConfig(ArrayList\<Integer> areaList, ZIMGeofencingType type)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| areaList | ArrayList<Integer> | List of geo-fenced areas. Set at least 1 area, and the maximum number of settings cannot be greater than the number supported by the SDK. |
| type | ZIMGeofencingType | Type of geo-fenced area. |
Details
Geofencing means that instant messaging data transmission is limited to a certain area to meet regional data privacy and security regulations, that is, to restrict access to communication services in a specific area.
- When to call /Trigger: The [setGeofencingConfig] interface needs to be called before the [create] interface.
- Caution: If you need to update geo fencing information, please call the [destroy] interface to destroy the current ZIM instance, and then call this interface.
- Available since: 2.12.0 and above.
- Restrictions: If you need to use this function, please contact ZEGO technical support.
Return
Geofencing setup results.
setCacheConfig
void setCacheConfig(ZIMCacheConfig config)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMCacheConfig | Cache configuration object. |
- Default value: Android:/storage/Android/data/[packageName]/files/ZIMCaches
iOS:
/Library/Caches/ZIMCaches macOS:(sandbox)/Library/Containers/[Bundle ID]/Data/Library/Caches/ZIMCaches / ~/Library/Caches/ZIMCaches Windows:C:\Users[Your UserName]\AppData[App Name]ZEGO.SDK\ZIMCaches
Call timing: It must be called before [create].
If the developer calls after [create], the SDK saves the configuration until it takes effect the next time [Create] is invoked.
- Related callbacks: In addition to getting the login result in the callback parameter, the developer will also receive the [onConnectionStateChanged] callback during the login request and after the login is successful/failed to determine the current user's login status.
Life cycle: Set before calling [create] and takes effect when calling [create]. If the developer does not set the new caches configuration the next time [create] is created, the previous configuration will still take effect.
Platform difference: The default path varies with platforms. Please refer to the default value.
addFriend
void addFriend(String userID, ZIMFriendAddConfig config, ZIMFriendAddedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userID | String | user ID. |
| config | ZIMFriendAddConfig | Add a friend related Configuration. |
| callback | ZIMFriendAddedCallback | Add a friend result callback. |
Details
Through this interface, a user with the specified userID can be added to the friend list.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [onFriendListChanged].
- Available since: 2.14.0 or above.
Return
Add a friend result callback.
sendFriendApplication
void sendFriendApplication(String userID, ZIMFriendApplicationSendConfig config, ZIMFriendApplicationSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userID | String | user ID. |
| config | ZIMFriendApplicationSendConfig | Send friend application for related configuration. |
| callback | ZIMFriendApplicationSentCallback | Send friend application result callback. |
- When to call: It can be called after creating a ZIM instance through [create].
- Related callbacks: [onFriendApplicationListChanged].
Return
Send friend application result callback.
deleteFriends
void deleteFriends(ArrayList\<String> userIDs, ZIMFriendDeleteConfig config, ZIMFriendsDeletedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | List of user IDs to delete. |
| config | ZIMFriendDeleteConfig | Delete friends related Configuration. |
| callback | ZIMFriendsDeletedCallback | Delete friends result callback. |
Details
Through this interface, the specified user can be deleted from the friend list.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [onFriendListChanged].
- Available since: 2.14.0 or above.
Return
Delete friends result callback.
checkFriendsRelation
void checkFriendsRelation(ArrayList\<String> userIDs, ZIMFriendRelationCheckConfig config, ZIMFriendsRelationCheckedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | List of user IDs to check. |
| config | ZIMFriendRelationCheckConfig | Check the configuration related to friend relationships. |
| callback | ZIMFriendsRelationCheckedCallback | Check the friend relationship result callback. |
Details
支持版本:2.14.0 及以上。
详情描述:通过该接口可以检查与指定用户之间的好友关系。
调用时机:必须在调用 [create] 创建实例之后,调用 [login] 登录后才可使用。
相关回调:[ZIMFriendsRelationCheckedCallback]。
Return
Check the friend relationship result callback.
updateFriendAlias
void updateFriendAlias(String friendAlias, String userID, ZIMFriendAliasUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| friendAlias | String | Friend alias. |
| userID | String | User ID. |
| callback | ZIMFriendAliasUpdatedCallback | Update a friend alias result callback. |
Details
Through this interface, the specified userID user can update the alias.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMFriendAliasUpdatedCallback].
- Available since: 2.14.0 or above.
Return
Update a friend alias result callback.
updateFriendAttributes
void updateFriendAttributes(HashMap<String, String> friendAttributes, String userID, ZIMFriendAliasUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| friendAttributes | HashMap<String, String> | Friend attributes. Up to 5 can be set. The key of the attribute can only be selected from k0 to k4. |
| userID | String | User ID. |
| callback | ZIMFriendAliasUpdatedCallback | Update a friend attributes result callback. |
Details
Through this interface, the specified userID user can update the attributes.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Available since: 2.14.0 or above.
Return
Update a friend attributes result callback.
acceptFriendApplication
void acceptFriendApplication(String userID, ZIMFriendApplicationAcceptConfig config, ZIMFriendApplicationAcceptedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userID | String | User ID. |
| config | ZIMFriendApplicationAcceptConfig | Accept friend application configuration. |
| callback | ZIMFriendApplicationAcceptedCallback | Accept the result callback of friend application. |
Details
After receiving the friend application, accept the friend application through this interface.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMFriendApplicationAcceptedCallback].
- Available since: 2.14.0 or above.
Return
Accept the result callback of friend application.
rejectFriendApplication
void rejectFriendApplication(String userID, ZIMFriendApplicationRejectConfig config, ZIMFriendApplicationRejectedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userID | String | User ID. |
| config | ZIMFriendApplicationRejectConfig | Reject friend application configuration. |
| callback | ZIMFriendApplicationRejectedCallback | Reject the result callback of friend application. |
Details
After receiving the friend application, reject the friend application through this interface.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMFriendApplicationRejectedCallback].
- Available since: 2.14.0 or above.
Return
Reject the result callback of friend application.
queryFriendsInfo
void queryFriendsInfo(ArrayList\<String> userIDs, ZIMFriendsInfoQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | User ID list. |
| callback | ZIMFriendsInfoQueriedCallback | Result callback for querying friend information in batches. |
Details
If you need to query the information of a group of designated friends for display, you can query it through this interface.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMFriendListQueriedCallback].
- Available since: 2.14.0 or above.
Return
Result callback for querying friend information in batches.
queryFriendList
void queryFriendList(ZIMFriendListQueryConfig config, ZIMFriendListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMFriendListQueryConfig | Query the configuration of the friend list. |
| callback | ZIMFriendListQueriedCallback | The returned result of querying the friends list. |
Details
The list of friends that need to be paged can be queried through this interface.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMFriendListQueriedCallback].
- Available since: 2.14.0 or above.
Return
Query the friend list and return results.
queryFriendApplicationList
void queryFriendApplicationList(ZIMFriendApplicationListQueryConfig config, ZIMFriendApplicationListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMFriendApplicationListQueryConfig | Query the friend application list configuration. |
| callback | ZIMFriendApplicationListQueriedCallback | Query the returned results of the friend application list. |
Details
If you need to paginate to query the list of friend applications, you can query through this interface.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMFriendApplicationListQueriedCallback].
- Available since: 2.14.0 or above.
Return
Query the returned results of the friend application list.
searchLocalFriends
void searchLocalFriends(ZIMFriendsSearchConfig config, ZIMFriendsSearchedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMFriendsSearchConfig | Friends search configuration. |
| callback | ZIMFriendsSearchedCallback | Search local friend information and return results. |
Details
Through this interface, you can search for local friend information based on keywords.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMFriendsSearchedCallback].
- Available since: 2.14.0 or above.
Return
Search local friend information and return results.
addUsersToBlacklist
void addUsersToBlacklist(ArrayList\<String> userIDs, ZIMBlacklistUsersAddedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | The list of userIDs to be added to blacklist. |
| callback | ZIMBlacklistUsersAddedCallback | Callback for operation results of adding users to the blacklist. |
Details
Through this interface, a user with the specified userID can be added to the blacklist.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMBlacklistUsersAddedCallback].
Usage restrictions: The number of userID passed in at one time cannot exceed 20.
- Available since: 2.13.0 or above.
removeUsersFromBlacklist
void removeUsersFromBlacklist(List\<String> userIDs, ZIMBlacklistUsersRemovedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | List<String> | userID list. |
| callback | ZIMBlacklistUsersRemovedCallback | The callback result of the operation to remove the user from the blacklist. |
Details
Through this interface, the user with the specified userID can be removed from the blacklist.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMBlacklistUsersRemovedCallback].
Usage restrictions: The number of userID passed in at one time cannot exceed 20.
- Available since: 2.13.0 or above.
queryBlacklist
void queryBlacklist(ZIMBlacklistQueryConfig config, ZIMBlacklistQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMBlacklistQueryConfig | Query the blacklist configuration. |
| callback | ZIMBlacklistQueriedCallback | Query the blacklist result callback. |
Details
Query the blacklist.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMBlacklistQueriedCallback].
- Available since: 2.13.0 or above.
checkUserIsInBlacklist
void checkUserIsInBlacklist(String userID, ZIMBlacklistCheckedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userID | String | The user ID information that needs to be checked is required. |
| callback | ZIMBlacklistCheckedCallback | Blacklist check result callback. |
Details
Through this interface, you can check whether a certain userID is on the blacklist.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMBlacklistCheckedCallback].
- Available since: 2.13.0 or above.
querySubscribedUserStatusList
void querySubscribedUserStatusList(ZIMSubscribedUserStatusQueryConfig config, ZIMSubscribedUserStatusListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMSubscribedUserStatusQueryConfig | Query the parameters related to the subscription list. |
| callback | ZIMSubscribedUserStatusListQueriedCallback | Result callback of querying the subscription list. |
Details
This command is used to query the user status subscription list of the current user.
- Use cases: Through this interface, you can obtain the local cache of the user status subscription list of the current user, so that you can know which users the current user has subscribed to, obtain the subscription expiration time of the subscriber, and obtain the status data of the subscriber when it changed last time.
- When to call /Trigger: It can be called after login, regardless of network status.
- Related callbacks: ZIMSubscribedUserStatusListQueriedCallback、subscribeUsersStatus、unsubscribeUsersStatus.
- Related APIs: subscribeUsersStatus、unsubscribeUsersStatus.
- Available since: 2.18.0
- Restrictions: The data obtained is the local cache of the SDK. When the network conditions are good after login, the SDK periodically synchronizes data to the background.
Return
Result callback.
queryUsersStatus
void queryUsersStatus(ArrayList\<String\> userIDs, ZIMUsersStatusQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | The query target user list. |
| callback | ZIMUsersStatusQueriedCallback | Callback method for querying user status. |
Details
Query the user statuses of other users.
- Use cases: When you do not need to continuously follow the user statuses of certain users but only need to obtain their user statuses once, you can use this method.
- When to call /Trigger: Can be called after login and when the network conditions are good.
The query targets can not include unregistered users.
- Related callbacks: ZIMUsersStatusQueriedCallback.
- Available since: 2.18.0
Return
Result callback.
subscribeUsersStatus
void subscribeUsersStatus(ArrayList\<String\> userIDs, ZIMUserStatusSubscribeConfig config, ZIMUsersStatusSubscribedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | List of subscribed users. |
| config | ZIMUserStatusSubscribeConfig | Subscribe to the relevant configuration items. |
| callback | ZIMUsersStatusSubscribedCallback | The operation callback of the user status subscription. |
Details
Subscribing to the user status of other users through this interface.
- Use cases: When you enter the group/room/friends list and need to know which room/group members/friends are online, subscribe through this interface. When the user status of these users is updated successfully, the [onUserStatusUpdated] interface is updated.
- When to call /Trigger: Can be called when the login is successful and the network conditions are good.
- Caution: You cannot subscribe to the current login user through this interface. The subscribed user must be registered.
- Related callbacks: [ZIMUsersStatusSubscribedCallback],[onUserStatusUpdated]
- Related APIs: [unsubscribeUsersStatus]
- Available since: 2.18.0
- Restrictions: The maximum number of subscribers is 100. By default, a single user can subscribe to a maximum of 3000 users. When the number of subscribers reaches the upper limit, the new subscribers will overwrite the original subscribers.
Return
Result callback.
unsubscribeUsersStatus
void unsubscribeUsersStatus(ArrayList\<String\> userIDs, ZIMUsersStatusUnsubscribedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | List of users that have been canceled in batch. |
| callback | ZIMUsersStatusUnsubscribedCallback | Callback of the operation result of batch cancellation. |
Details
Batch unsubscribe the target user in the current user subscription list.
- Use cases: In non-multi-terminal login scenarios, when you leave a room or group, if you no longer follow the user status of the room or group members for a short period of time, and you have subscribed to the user status of the room or group members when you enter the room or group, you can unsubscribe through this interface.
- When to call /Trigger: Called after login and when the network is in good condition.
- Caution: You cannot cancel a user that is not in the current user subscription list.
- Related callbacks: ZIMUsersStatusUnsubscribedCallback.
- Related APIs: subscribeUsersStatus、queryUsersStatus、querySubscribedUserStatusList.
- Available since: 2.18.0
- Restrictions: The maximum number of userids passed in at a time is 100.
Return
Result callback.
updateUserCustomStatus
ZIMUserCustomStatusUpdatedResult updateUserCustomStatus(String customStatus, ZIMUserCustomStatusUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| customStatus | String | Description: User-defined status. The default maximum value is 64 bytes. The default expiration time is 1 day. At login, if the field is an empty string (which is the default), the current user's custom state is not modified. |
| callback | ZIMUserCustomStatusUpdatedCallback | The callback of the custom status update. |
Details
You can define the status, such as DND and Busy, based on your service requirements.
- Use cases: After login, call the interface to modify the current user's custom status as "do not disturb", "busy" and other states.
- When to call /Trigger: After an online login and a network connection exists.
- Related callbacks: After the interface is successfully invoked to update the user-defined status, other devices that are logged in to multiple devices and users who subscribe to the current user status through subscribeUsersStatus receive onUserStatusUpdated and updates the user-defined status of the current user.
- Available since: 2.20.0 and later.
- Restrictions: 1 time/second
Return
The result of the custom status update.
updateUserOfflinePushRule
void updateUserOfflinePushRule(ZIMUserOfflinePushRule offlinePushRule, ZIMUserOfflinePushRuleUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| offlinePushRule | ZIMUserOfflinePushRule | The user pushes the rule information offline, and the interface will be fully updated with the member properties of the input object each time the interface is called. |
| callback | ZIMUserOfflinePushRuleUpdatedCallback | Modify the result callback of offline push. |
Details
This interface is used to modify the custom rule of offline push for the current user.
- Use cases: For example, in the multi-terminal login scenario, the developer hopes that when the desktop is online, the mobile terminal does not want to receive offline push. In this scenario, the interface can be invoked to achieve this function.
- When to call /Trigger: You can call it after you log in and the network is in good condition.
- Caution: After the interface is successfully invoked, all ends will receive onUserRuleUpdate notifying the user that the rule has been updated.
- Related callbacks: onUserRuleUpdate、ZIMUserOfflinePushRuleUpdatedCallback
- Related APIs: querySelfUserInfo
- Available since: 2.15.0 and later versions.
Return
Modify the result callback of offline push.
querySelfUserInfo
void querySelfUserInfo(ZIMSelfUserInfoQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| callback | ZIMSelfUserInfoQueriedCallback | Callback result of querying user information and user rules. |
Details
Query information about the current user and user rules. In offline state, you can query local data.
- Use cases: If you need to display the user information and rules, you can invoke the query, for example, to enter the personal page of the current user.
- When to call /Trigger: Call after login.
- Available since: 2.15.0 及以后版本。
- Restrictions: ZIMSelfUserInfoQueriedCallback、userInfoUpdated、userRuleUpdated
Return
Callback result of querying user information and user rules.
setEventHandler
void setEventHandler(ZIMEventHandler handler)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| handler | ZIMEventHandler | Event notification callback. Developers should override callbacks to focus on specific notifications based on their own business scenarios. |
Details
Supported version: 1.1.0 and above.
Detailed description: Set event notification callback, pass [null] to clear the set callback.
Calling timing: After calling [create] to create an instance, this function must be called through the instance.
If the developer calls this function multiple times, it will overwrite the callback set by the last call to this function.
Life cycle: Set this function after calling [create], and you can receive ZIM-related event notifications normally; after calling [destroy], you will no longer receive any event notifications.
Related reference: For details, please refer to https://doc-zh.zego.im/article/api?doc=zim_API~java_android~class~ZIMEventHandler.
login
void login(ZIMUserInfo userInfo, String token, ZIMLoggedInCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userInfo | ZIMUserInfo | Unique ID used to identify the user. Note that the userID must be unique under the same appID, otherwise mutual kicks out will occur. Note: Do not set ZIMUserInfo.userAvatarUrl through this interface. |
| token | String | The token issued by the developer's business server, used to ensure security. The generation rules are detailed in ZEGO document website. The token validity period cannot exceed 24 days. |
| callback | ZIMLoggedInCallback |
- Related callbacks: In addition to getting the login result in the callback parameter, the developer will also receive the [onConnectionStateChanged] callback during the login request and after the login is successful/failed to determine the current user's login status.
Related reference: For details, please refer to Authentication (https://docs.zegocloud.com/article/13772).
Return
Callback of login result.
login
void login(ZIMUserInfo userInfo, ZIMLoggedInCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userInfo | ZIMUserInfo | Unique ID used to identify the user. Note that the userID must be unique under the same appID, otherwise mutual kicks out will occur. Note: Do not set ZIMUserInfo.userAvatarUrl through this interface. |
| callback | ZIMLoggedInCallback |
- Related callbacks: In addition to getting the login result in the callback parameter, the developer will also receive the [onConnectionStateChanged] callback during the login request and after the login is successful/failed to determine the current user's login status.
Return
Callback of login result.
login
void login(String userID, ZIMLoginConfig config, ZIMLoggedInCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userID | String | Used to identify user information, the unique ID of the user. |
| config | ZIMLoginConfig | Various parameters used for specific login actions. |
| callback | ZIMLoggedInCallback |
- Related callbacks: In addition to getting the login result in the callback parameter, the developer will also receive the [onConnectionStateChanged] callback during the login request and after the login is successful/failed to determine the current user's login status.
Related reference: For details, please refer to Authentication (https://docs.zegocloud.com/article/13772).
Return
Callback of login result.
renewToken
void renewToken(String token, ZIMTokenRenewedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| token | String | The token issued by the developer's business server, used to ensure security. The generation rules are detailed in ZEGO document website. |
| callback | ZIMTokenRenewedCallback | Callback of the renewing token result. |
Details
Update the authentication token so that the authentication token can be updated in time after it expires, so as to continue to use ZIM functions normally.
- Use cases: When you need to create a multi-person chat scene, you can create and join a room by this API.
- When to call: This function must be called through the instance after calling [create] to create the instance.
- Caution: After the developer receives the [onTokenWillExpire] callback, the developer needs to request the authentication server to regenerate a token in time.
- Available since: 1.1.0 or above.
Return
Callback of the renewing token result.
queryUsersInfo
void queryUsersInfo(ArrayList\<String> userIDs, ZIMUsersInfoQueryConfig config, onUsersInfoQueried callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | userID list. |
| config | ZIMUsersInfoQueryConfig | Query user information configuration. |
| callback | onUsersInfoQueried | Callback for querying user information returns the query result. |
Details
Through this interface, you can query and obtain the corresponding UserInfo by userID.
- When to call /Trigger: It is available only after calling [create] to create the instance and then calling [login] to login.
- Related callbacks: [ZIMUsersInfoQueriedCallback].
Usage restrictions: No more than 10 userids can be queried by invoking the interface at a time. If the interface is invoked multiple times within 10 seconds, the total number of userids queried cannot exceed 10.
- Available since: 2.3.0 or above.
Return
Callback of the query user result.
updateUserName
void updateUserName(String userName, ZIMUserNameUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userName | String | User name , It is customized by the developer. For version 2.0.0 and onwards, the string has a maximum length of 256 bytes. |
| callback | ZIMUserNameUpdatedCallback | The callback of the update user name. |
Details
After user logs in, calling this interface could update the user's own user name.
- When to call: After the user is logged in.
This interface does not support modifying user names in rooms.
- Privacy reminder: Try not to pass in sensitive information involving personal privacy, including but not limited to mobile phone numbers, ID numbers, passport numbers, real names, etc.
- Related callbacks: [ZIMUserNameUpdatedCallback].
- Related APIs: [updateUserExtendedData] and [queryUsersInfo].
- Available since: 2.2.0 or above.
Return
The result of the update user name.
updateUserAvatarUrl
void updateUserAvatarUrl(String userAvatarUrl, ZIMUserAvatarUrlUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userAvatarUrl | String | User avatar URL wanted to changed to . |
| callback | ZIMUserAvatarUrlUpdatedCallback | Callback for user profile picture update. |
Details
Supported versions: 2.3.0 and above.
Detail description: After the user logs in, calling this interface can set or update the user's own user avatar URL.
Call timing/notify timing: After the user logs in.
The user avatar itself needs to be stored by the developer, and ZIM only saves its user information as a pass-through URL.
Usage Restriction: There is no limit on special characters and a maximum of 500 bytes.
Related callback: [ZIMUserAvatarUrlUpdatedCallback].
Related interface: [queryUsersInfo].
Return
The result of the update user avatar URL.
updateUserExtendedData
void updateUserExtendedData(String extendedData, ZIMUserExtendedDataUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| extendedData | String | User extended data wanted to changed to . |
| callback | ZIMUserExtendedDataUpdatedCallback | The callback of the update user extended data. |
Details
After user logs in, calling this interface could update the user's own user extended data.
- When to call: After the user is logged in.
- Privacy reminder: Try not to pass in sensitive information involving personal privacy, including but not limited to mobile phone numbers, ID numbers, passport numbers, real names, etc.
- Related callbacks: [ onUserNameUpdatedCallback ].
- Related APIs: [updateUserName] and [ queryUsersInfo ].
- Available since: 2.2.0 or above.
Return
The result of the update user extended data.
uploadLog
void uploadLog(ZIMLogUploadedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| callback | ZIMLogUploadedCallback |
- Related callbacks: Developers can get the upload results through the callback parameter.
Return
The result of the log upload.
logout
void logout()ZIM.javaLog out of the ZIM service.
- Use cases: This function must be called from the instance after it has been created by calling [create].
- When to call: After invoking [logout], you can no longer use ZIM's chat, room, send and receive, and other functions. To use the ZIM service again, the developer must call [login] to login again.
- Caution: Upon logout, the developer will receive the [onConnectionStateChanged] callback with the login state being [Disconnected].
- Available since: 1.1.0 or above.
destroy
void destroy()ZIM.javaSupported version: 1.1.0 and above.
Detailed description: Release the resources used by the ZIM instance. This function must be called to release the occupied memory resources when ZIM is no longer needed, otherwise a memory leak may occur.
Call timing: call when ZIM is no longer needed, usually before emptying the ZIM object.
After calling this function, ZIM internal functions can no longer be used, and all callback notifications will no longer be triggered. If you need to continue using the ZIM function, please call [create] again to create a new instance.
callInvite
void callInvite(ArrayList\<String> invitees, ZIMCallInviteConfig config, ZIMCallInvitationSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| invitees | ArrayList<String> | list of invitees. |
| config | ZIMCallInviteConfig | Call Invitation Related Configuration. |
| callback | ZIMCallInvitationSentCallback | Callback for initiating a call invitation. |
- When to call: It can be called after creating a ZIM instance through [create].
The call invitation has a timeout period, and the call invitation will end when the timeout period expires.
- Related callbacks: [ZIMCallInvitationSentCallback].
Return
Callback of the call invite result.
callJoin
void callJoin(String callID, ZIMCallJoinConfig config, ZIMCallJoinSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| callID | String | The advanced call ID which user wants to join. |
| config | ZIMCallJoinConfig | Related configuration for join call invitations. |
| callback | ZIMCallJoinSentCallback | The callback of the operation to join the call or switch to the main device. |
Details
After create an advanced mode call invitation, you can invoke this interface to join the call or switch the primary device.
- Use cases: Users who are not in the call join the call, and users who are already in the call switch to the primary device.
- When to call: Need to be invoked after logged in.
- Available since: 2.12.0.
Return
The callback of the operation to join the call or switch to the main device.
callCancel
void callCancel(List<String> invitees, String callID, ZIMCallCancelConfig config, ZIMCallCancelSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| invitees | List<String> | List of invitees. |
| callID | String | The ID of the call invitation to cancel. |
| config | ZIMCallCancelConfig | Cancel the related configuration of call invitation. |
| callback | ZIMCallCancelSentCallback | Callback for canceling a call invitation. |
- When to call: It can be called after creating a ZIM instance through [create].
Canceling the call invitation after the timeout period of the call invitation expires will fail.
- Related callbacks: [ZIMCallCancelSentCallback].
Return
Callback of the call cancel result.
callAccept
void callAccept(String callID, ZIMCallAcceptConfig config, ZIMCallAcceptanceSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| callID | String | The call invitation ID to accept. |
| config | ZIMCallAcceptConfig | Configuration related to accepting call invitations. |
| callback | ZIMCallAcceptanceSentCallback | Callback to accept call invitation. |
- When to call: It can be called after creating a ZIM instance through [create].
The callee will fail to accept an uninvited callid.
- Related callbacks: [ZIMCallAcceptanceSentCallback].
Return
Callback of the call accept result.
callReject
void callReject(String callID, ZIMCallRejectConfig config, ZIMCallRejectionSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| callID | String | The ID of the call invitation to be rejected. |
| config | ZIMCallRejectConfig | Related configuration for rejecting call invitations. |
| callback | ZIMCallRejectionSentCallback | Callback for rejecting call invitations. |
- When to call: It can be called after creating a ZIM instance through [create].
The callee will fail to reject the uninvited callid.
- Related callbacks: [ZIMCallRejectionSentCallback].
Return
Callback of the call reject result.
callQuit
void callQuit(String callID, ZIMCallQuitConfig config, ZIMCallQuitSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| callID | String | The ID of the call invitation to be quit. |
| config | ZIMCallQuitConfig | Related configuration for quit call invitations. |
| callback | ZIMCallQuitSentCallback | Callback for quit call invitations. |
- When to call: After the call is established, users whose call status is Accepted can call this interface.
The callee will fail to quit the uninvited callid.
- Related callbacks: [ZIMCallQuitSentCallback].
Return
Callback of the call quit result.
callEnd
void callEnd(String callID, ZIMCallEndConfig config, ZIMCallEndSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| callID | String | The ID of the call invitation to be ended. |
| config | ZIMCallEndConfig | Related configuration for end call invitations. |
| callback | ZIMCallEndSentCallback | Callback for end call invitations. |
- When to call: The call was in advanced mode and the user status was Accepted.
User calls that are not in the call will fail. ZIM SDK Does not have service logic after the call ends, and developers can customize the development logic after the end.
- Related callbacks: [ZIMCallEndSentCallback].
Return
Callback of the call end result.
callingInvite
void callingInvite(ArrayList\<String> invitees, String callID, ZIMCallingInviteConfig config, ZIMCallingInvitationSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| invitees | ArrayList<String> | List of invited user ids. |
| callID | String | callID of the current call in advanced mode. |
| config | ZIMCallingInviteConfig | This section describes how to configure the call invitation. |
| callback | ZIMCallingInvitationSentCallback | Invite the callback of the current call. |
- When to call: After calling [callInvite] to initiate a call invitation in advanced mode.
User calls that are not in the call will fail. ZIM SDK has no relevant business logic after accepting. Developers can customize the development logic after adding calls. By default, a call can contain a maximum of 9 users.
- Related callbacks: [ZIMCallingInvitationSentCallback].
Return
Callback result of inviting the current call.
queryCallInvitationList
void queryCallInvitationList(ZIMCallInvitationQueryConfig config, ZIMCallInvitationListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMCallInvitationQueryConfig | Query the relevant configuration of the call invitation list. |
| callback | ZIMCallInvitationListQueriedCallback | Inquire the results of the call invitation list. |
- When to call: Run [create] to create a ZIM instance, which can be invoked after login.
- Related callbacks: [ZIMCallInvitationListQueriedCallback].
Return
Inquire the results of the call invitation list.
createGroup
void createGroup(ZIMGroupInfo groupInfo, List\<String> userIDs, ZIMGroupCreatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupInfo | ZIMGroupInfo | Configuration information for the group to be created. |
| userIDs | List<String> | List of users invited to the group. |
| callback | ZIMGroupCreatedCallback | Callback for the result of creating a group. |
Details
You can call this interface to create a group, and the person who calls this interface is the group leader. An empty string if the group name is left blank.
- Use cases: You can use this interface to create a chat scenario and join a group.
- When to call: After you create a ZIM instance with [create] and login with [login].
- Impacts on other APIs: You can use [joinGroup] to join a group, [leaveGroup] to leave a group, or [dismissGroup] to dismiss a group.
- Related callbacks: The result of creating the group is obtained through the [ZIMGroupCreatedCallback] callback.
- Related APIs: Call [joinGroup] to join a group, call [leaveGroup] to leave a group, call [dismissGroup] to dismiss a group.
- Available since: 2.0.0 and above.
- Restrictions: Available after login, unavailable after logout. UserIDs support a maximum of 100 users .
searchLocalGroups
void searchLocalGroups(ZIMGroupSearchConfig config, ZIMGroupsSearchedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMGroupSearchConfig | Configuration for searching groups. |
| callback | ZIMGroupsSearchedCallback | Callback of the search groups result. |
- Related callbacks: [ZIMGroupsSearchedCallback].
- Restrictions: Takes effect after login, becomes invalid after logout.
Return
Callback of the search groups result.
searchLocalGroupMembers
public void searchLocalGroupMembers(String groupID, ZIMGroupMemberSearchConfig config, ZIMGroupMembersSearchedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupID | String | Group ID of the joined group. |
| config | ZIMGroupMemberSearchConfig | The configuration for searching group members. |
| callback | ZIMGroupMembersSearchedCallback | Callback for the result of searching group members. |
- Related callbacks: [ZIMGroupMembersSearchedCallback].
- Restrictions: Takes effect after login, becomes invalid after logout.
Return
Callback for the result of searching group members.
createGroup
void createGroup(ZIMGroupInfo groupInfo, List<String> userIDs, ZIMGroupAdvancedConfig config, ZIMGroupCreatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupInfo | ZIMGroupInfo | Configuration information for the group to be created. |
| userIDs | List<String> | List of users invited to the group. |
| config | ZIMGroupAdvancedConfig | Create the relevant configuration of the group. |
| callback | ZIMGroupCreatedCallback | Callback for the result of creating a group. |
Details
You can call this interface to create a group, and the person who calls this interface is the group leader.
- Use cases: You can use this interface to create a chat scenario and join a group.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Caution: Available after login, unavailable after logout. UserIDs can have a maximum of 100 users and a group can have a maximum of 500 users.
- Related callbacks: The result of creating the group is obtained through the [ZIMGroupCreatedCallback] callback.
- Related APIs: You can use [joinGroup] to join a group, [leaveGroup] to leave a group, or [dismissGroup] to dismiss a group.
- Available since: 2.0.0 and above.
Return
Callback for the result of creating a group.
joinGroup
void joinGroup(String groupID, ZIMGroupJoinedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupID | String | The group ID to join. |
| callback | ZIMGroupJoinedCallback | Callback for the result of joining the group. |
Details
When a group is created, other users can join the group through [joinGroup]. If the group does not exist, the joining fails.
- Use cases: This interface is used to join a group in a chat scenario.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Caution: Available after login, unavailable after logout. If you have joined a group, the join succeeds.
- Related callbacks: To get the result of joining the room, call [ZIMGroupJoinedCallback].
- Related APIs: You can use [createGroup] to create a group, [leaveGroup] to leave a group, or [dismissGroup] to dismiss a group.
- Available since: 2.0.0 and above.
Return
Callback for the result of joining the group.
leaveGroup
void leaveGroup(String groupID, ZIMGroupLeftCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupID | String | The group ID to leave. |
| callback | ZIMGroupLeftCallback | Callback for the result of leaving the group. |
Details
After a user joins a group, the user can leave the group through this interface.
- Use cases: This interface is used to exit a chat group.
- When to call /Trigger: It can be invoked after a ZIM instance is created through [create] and logged in.
- Caution: When the group owner quits the group, the identity of the group owner will be automatically transferred to the earliest member who joined the group. When all members exit the group, the group is automatically dissolved.
- Impacts on other APIs: You can use [createGroup] to create a group, [joinGroup] to join a group, or [dismissGroup] to dismiss a group.
- Related callbacks: The result of leaving the room can be obtained by the [ZIMGroupLeftCallback] callback.
- Available since: 2.0.0 and above.
- Restrictions: Available after login, unavailable after logout.
Return
Callback for the result of leaving the group.
dismissGroup
void dismissGroup(String groupID, ZIMGroupDismissedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupID | String | The ID of the group to be disbanded. |
| callback | ZIMGroupDismissedCallback | Callback for the result of disbanding the group. |
Details
When a group is created, you can use [dismissGroup] to dismiss it.
- Use cases: After you create a chat group, you do not need to use this interface to dissolve the group.
- When to call /Trigger: This parameter can be called after a group is created by using [createGroup].
- Caution: A non-group owner cannot dissolve a group.
- Related callbacks: Through callback can get [ZIMGroupDismissedCallback] dissolution results of the room, through [onGroupStateChanged] listen callback can get the room status.
- Related APIs: You can use [createGroup] to create a group, [joinGroup] to join a group, and [leaveGroup] to leave a group.
- Available since: 2.0.0 and above.
Return
Callback for the result of disbanding the group.
kickGroupMembers
void kickGroupMembers(List\<String> userIDs, String groupID, ZIMGroupMemberKickedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | List<String> | List of users who have been kicked out of the group. |
| groupID | String | The group ID of the member who will be kicked out. |
| callback | ZIMGroupMemberKickedCallback | Callback for the result of being kicked out of the group. |
Details
After a user joins a group, you can use this method to remove the user from the group.
- Use cases: You can use this method to remove one or more users from the group.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Caution: This interface does not require the peer's consent or the peer's online status. It cannot accept group-related callbacks after being kicked out. History messages and sessions remain after being kicked out and can still enter the group.
- Related callbacks: Through the callback [ZIMGroupMemberKickedCallback] can get the user kicked out the results of the group.
- Related APIs: You can invite a target user into a group through [inviteUsersIntoGroup].
- Available since: 2.0.0 and above.
- Restrictions: You can't kick someone unless you're the leader of the group.
Return
Callback for the result of being kicked out of the group.
inviteUsersIntoGroup
void inviteUsersIntoGroup(List\<String> userIDs, String groupID, ZIMGroupUsersInvitedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | List<String> | List of users who have been invited to the group, the maximum number supported in a single operation is 100. |
| groupID | String | The group ID of the member who will be invited to join. |
| callback | ZIMGroupUsersInvitedCallback | Callback for the result of being invited to the group. |
Details
When users need to be invited to join the group, they can be invited to the group by this method. If the group does not exist, the invitation will fail.
- Use cases: You can use this method to invite one or more users to the group.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Caution: This interface does not require the peer's consent or the peer's online status.
- Related callbacks: Through the callback [ZIMGroupUsersInvitedCallback] can get the user invited to the results of the group.
- Related APIs: You can kick out a target user into a group through [kickGroupMembers].
- Available since: 2.0.0 and above.
- Restrictions: You can't invite someone unless you're the leader of the group.
Return
Callback for the result of being invited to the group.
transferGroupOwner
void transferGroupOwner(String toUserID, String groupID, ZIMGroupOwnerTransferredCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| toUserID | String | The converted group owner ID. |
| groupID | String | The group ID of the group owner to be replaced. |
| callback | ZIMGroupOwnerTransferredCallback | The callback of the transfer group owner. |
Details
After a group is created, the group owner can use this method to assign the group owner to a specified user.
- Use cases: In a group chat scenario, you can transfer the group master through this interface.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through the callback [ZIMGroupOwnerTransferredCallback] can get the result of the transfer of the group manager.
- Available since: 2.0.0 and above.
- Restrictions: You cannot transfer a group owner if you are not a group owner.
Return
The callback of the transfer group owner.
updateGroupAlias
void updateGroupAlias(String groupAlias, String groupID, ZIMGroupAliasUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupAlias | String | The new group alias. Maximum length is 256 bytes. |
| groupID | String | The group ID whose group alias will be updated. |
| callback | ZIMGroupAliasUpdatedCallback | Callback for the result of updating the group alias. |
Details
After a group is created, users can call this method to change the group alias.
- Use cases: To distinguish different group.
- When to call: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through the callback [ZIMGroupAliasUpdatedCallback] can get the result of the change of group alias.
- Available since: 2.18.0 and above.
Return
The result of updating the group alias.
updateGroupName
void updateGroupName(String groupName, String groupID, ZIMGroupNameUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupName | String | The group name that needs to be updated. |
| groupID | String | The group ID whose group name will be updated. |
| callback | ZIMGroupNameUpdatedCallback | Callback for the result of updating the group name. |
Details
After a group is created, users can call this method to change the group name.
- Use cases: After creating a group, you need to change the group name.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through the callback [ZIMGroupNameUpdatedCallback] can get the result of the change of name, through [onGroupNoticeUpdated] can get update group name information.
- Available since: 2.0.0 and above.
- Restrictions: Group members and group owners can change the group name. The maximum length of the name is 100 bytes.
Return
Callback for the result of updating the group name.
muteGroup
void muteGroup(boolean isMute, String groupID, ZIMGroupMuteConfig config, ZIMGroupMutedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| isMute | boolean | Identify the action as either muting the group or unmuting the group. |
| groupID | String | The group ID whose group mute info will be updated. |
| config | ZIMGroupMuteConfig | Configuration for group mute. |
| callback | ZIMGroupMutedCallback | Callback for the result of updating the group mute info. |
Details
Once a group is created, the group administrator can call this interface to implement group muting and unmuting.
- Use cases: After creating a group, users need to change the mute status of the group.
- When to call: This can be called after a ZIM instance is created using [create] and logged into the group.
- Related callbacks: The result of changing the group mute status can be obtained through the [ZIMGroupMutedCallback] callback. The updated group mute status information can be obtained through [onGroupMuteInfoUpdated].
- Available since: 2.14.0 and above.
- Restrictions: This can be called by the group owner and group administrators.
Return
Callback for the result of updating the group mute info.
muteGroupMembers
void muteGroupMembers(boolean isMute, ArrayList\<String> userIDs, String groupID, ZIMGroupMemberMuteConfig config, ZIMGroupMembersMutedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| isMute | boolean | Identify the action as either muting the group members or unmuting the group members. |
| userIDs | ArrayList<String> | The group member ID that needs to change the mute status. |
| groupID | String | The group ID whose group members mute info will be updated. |
| config | ZIMGroupMemberMuteConfig | Configuration for group members mute. |
| callback | ZIMGroupMembersMutedCallback | Callback for the result of updating the group members mute info. |
Details
Once a group is created, the group administrator can call this interface to implement group members muting and unmuting.
- Use cases: After creating a group, users need to change the mute status of the group members.
- When to call: This can be called after a ZIM instance is created using [create] and logged into the group.
- Related callbacks: The result of changing the group members mute status can be obtained through the [ZIMGroupMembersMutedCallback] callback. The updated group members mute status information can be obtained through [onGroupMemberInfoUpdated].
- Available since: 2.14.0 and above.
- Restrictions: This can be called by the group owner and group administrators.
Return
Callback for the result of updating the group members mute info.
updateGroupAvatarUrl
void updateGroupAvatarUrl(String groupAvatarUrl, String groupID, ZIMGroupAvatarUrlUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupAvatarUrl | String | The group avatar URL that needs to be updated. Usage Restriction: There is no limit on special characters and a maximum of 500 bytes. |
| groupID | String | The group ID of the group avatar URL that will be updated. |
| callback | ZIMGroupAvatarUrlUpdatedCallback | Callback for the result of updating the group avatar URL. |
- Related callbacks: The result of changing the group name can be obtained through the [ZIMGroupAvatarUrlUpdatedCallback] callback, and the updated group avatar information can be obtained through the [onGroupAvatarUrlUpdated] callback.
Return
Callback for the result of updating the group avatar URL.
updateGroupNotice
void updateGroupNotice(String groupNotice, String groupID, ZIMGroupNoticeUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupNotice | String | Pre-updated group announcements. |
| groupID | String | The group ID of the group announcement that will be updated. |
| callback | ZIMGroupNoticeUpdatedCallback | Callback to update the results of group announcements. |
Details
When a group is created, users can use this method to update the group bulletin.
- Use cases: You need to update the group bulletin in the group.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through callback [ZIMGroupNoticeUpdateCallback] can get update group of the results announcement, announcement by [onGroupNoticeUpdated] can get update group information.
- Available since: 2.0.0 and above.
- Restrictions: Only group members can update the group bulletin. The maximum number of bytes is 300. There is no special character limit.
Return
Callback to update the results of group announcements.
updateGroupJoinMode
void updateGroupJoinMode(ZIMGroupJoinMode mode, String groupID, ZIMGroupJoinModeUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| mode | ZIMGroupJoinMode | Group verification mode. |
| groupID | String | The group ID. |
| callback | ZIMGroupJoinModeUpdatedCallback | Callback for the result of the update operation. |
Details
When a group is created, the group owner and administrators can use this method to update the group verification mode.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Available since: 2.15.0 and above.
Return
Callback for the result of the update operation.
updateGroupInviteMode
void updateGroupInviteMode(ZIMGroupInviteMode mode, String groupID, ZIMGroupInviteModeUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| mode | ZIMGroupInviteMode | Group verification mode. |
| groupID | String | The group ID. |
| callback | ZIMGroupInviteModeUpdatedCallback | Callback for the result of the update operation. |
Details
When a group is created, the group owner and administrators can use this method to update the group verification mode.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Available since: 2.15.0 and above.
Return
Callback for the result of the update operation.
acceptGroupInviteApplication
void acceptGroupInviteApplication(String inviterUserID, String groupID, ZIMGroupInviteApplicationAcceptConfig config, ZIMGroupInviteApplicationAcceptedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| inviterUserID | String | Inviter user ID. |
| groupID | String | The group ID. |
| config | ZIMGroupInviteApplicationAcceptConfig | Agree to the configuration of the application to invite the group. |
| callback | ZIMGroupInviteApplicationAcceptedCallback | Callback for the result of the operation. |
Details
When a group's beInviteMode mode is Auth, users outside the group can accept the invitation through this method and become group members after receiving the group invitation.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Available since: 2.15.0 and above.
Return
Callback for the result of the operation.
acceptGroupJoinApplication
void acceptGroupJoinApplication(String userID, String groupID, ZIMGroupJoinApplicationAcceptConfig config, ZIMGroupJoinApplicationAcceptedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userID | String | Applicant user ID. |
| groupID | String | The group ID. |
| config | ZIMGroupJoinApplicationAcceptConfig | Agree to the configuration of the application to join the group. |
| callback | ZIMGroupJoinApplicationAcceptedCallback | Callback for the result of the operation. |
Details
When a group's joinMode requires Auth, after an external user sends a group application, the group owner or administrator can agree to the application through this method.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Available since: 2.15.0 and above.
Return
Callback for the result of the operation.
queryGroupApplicationList
void queryGroupApplicationList(ZIMGroupApplicationListQueryConfig config, ZIMGroupApplicationListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMGroupApplicationListQueryConfig | Query the configuration of the application list. |
| callback | ZIMGroupApplicationListQueriedCallback | Callback for the result of the operation. |
Details
The query results include your own application to join the group and your application to be invited to join the group. When the user is a group owner or administrator, the query results will also include other people's applications to join the group and their own applications to invite others to the group.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Available since: 2.15.0 and above.
Return
Callback for the result of the operation.
rejectGroupInviteApplication
void rejectGroupInviteApplication(String inviterUserID, String groupID, ZIMGroupInviteApplicationRejectConfig config, ZIMGroupInviteApplicationRejectedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| inviterUserID | String | Inviter user ID. |
| groupID | String | The group ID. |
| config | ZIMGroupInviteApplicationRejectConfig | Reject to the configuration of the application to invite the group. |
| callback | ZIMGroupInviteApplicationRejectedCallback | Callback for the result of the operation. |
Details
When a group's beInviteMode requires Auth, users invited to the group can reject the invitation through this method.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Available since: 2.15.0 and above.
Return
Callback for the result of the operation.
rejectGroupJoinApplication
void rejectGroupJoinApplication(String userID, String groupID, ZIMGroupJoinApplicationRejectConfig config, ZIMGroupJoinApplicationRejectedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userID | String | Applicant user ID. |
| groupID | String | The group ID. |
| config | ZIMGroupJoinApplicationRejectConfig | Reject to the configuration of the application to join the group. |
| callback | ZIMGroupJoinApplicationRejectedCallback | Callback for the result of the operation. |
Details
When a group's joinMode is Auth, the group owner or administrator can reject to the user's application to join the group through this method.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Available since: 2.15.0 and above.
Return
Callback for the result of the operation.
sendGroupInviteApplications
void sendGroupInviteApplications(ArrayList\<String> userIDs, String groupID, ZIMGroupInviteApplicationSendConfig config, ZIMGroupInviteApplicationsSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | List of invited users, the maximum number supported in a single operation is 20. |
| groupID | String | The group ID. |
| config | ZIMGroupInviteApplicationSendConfig | Invite to the group to apply for configuration. |
| callback | ZIMGroupInviteApplicationsSentCallback | Callback for the result of the operation. |
Details
When a group's invitation verification mode requires approval by the invitee, group members can send invitations to the group through this method.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Available since: 2.15.0 and above.
Return
Callback for the result of the operation.
sendGroupJoinApplication
void sendGroupJoinApplication(String groupID, ZIMGroupJoinApplicationSendConfig config, ZIMGroupJoinApplicationSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupID | String | The group ID. |
| config | ZIMGroupJoinApplicationSendConfig | Join the group to apply for configuration. |
| callback | ZIMGroupJoinApplicationSentCallback | Callback for the result of the operation. |
Details
When a group's joinMode is Auth, users can apply to join the group through this method.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Available since: 2.15.0 and above.
Return
Callback for the result of the operation.
updateGroupBeInviteMode
void updateGroupBeInviteMode(ZIMGroupBeInviteMode mode, String groupID, ZIMGroupBeInviteModeUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| mode | ZIMGroupBeInviteMode | Group verification mode. |
| groupID | String | The group ID. |
| callback | ZIMGroupBeInviteModeUpdatedCallback | Callback for the result of the update operation. |
Details
After a group is created, the group owner and administrators can update the invited group verification mode through this method.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Available since: 2.15.0 and above.
Return
Callback for the result of the update operation.
queryGroupInfo
void queryGroupInfo(String groupID, ZIMGroupInfoQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupID | String | The group ID of the group information to be queried. |
| callback | ZIMGroupInfoQueriedCallback | Callback for the result of querying group information. |
Details
Query information about a created group.
- Use cases: You need to obtain group information for display.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through the callback [ZIMGroupInfoQueriedCallback] can query the result of the group information.
- Available since: 2.0.0 and above.
- Restrictions: Available after login, unavailable after logout.
Return
Callback for the result of querying group information.
queryGroupList
void queryGroupList(ZIMGroupListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| callback | ZIMGroupListQueriedCallback | Callback for querying the result of the group list. |
Details
Query the list of all groups.
- Use cases: You need to get a list of groups to display.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through the callback [ZIMGroupListQueriedCallback] can get a check list of all current group results.
- Available since: 2.0.0 and above.
- Restrictions: Available after login, unavailable after logout.
Return
Callback for querying the result of the group list.
setGroupAttributes
void setGroupAttributes(HashMap<String, String> groupAttributes, String groupID, ZIMGroupAttributesOperatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupAttributes | HashMap<String, String> | group attributes. |
| groupID | String | groupID. |
| callback | ZIMGroupAttributesOperatedCallback | Callback for setting group attributes. |
Details
If a group already exists, all users of the group can use this method to set group attributes.
- Use cases: Added extended field information about group description, such as group family, label, and industry category.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through the callback [ZIMGroupAttributesOperatedCallback] can get the result of the set of attributes.
- Related APIs: [deleteGroupAttributes] can be used to deleteGroupAttributes, [queryGroupAttributes] can be used to queryGroupAttributes, [queryAllGroupAttributes] can be used to queryAllGroupAttributes.
- Available since: 2.0.0 and above.
- Restrictions: Only group members can set group attributes.
Return
Callback for setting group attributes.
deleteGroupAttributes
void deleteGroupAttributes(List<String> keys, String groupID, ZIMGroupAttributesOperatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| keys | List<String> | The key of the group attribute to delete. |
| groupID | String | The group ID of the group attribute to be deleted. |
| callback | ZIMGroupAttributesOperatedCallback | Callback for the result of removing the group attributes. |
Details
When a group already exists, you can use this method to delete group attributes. Both the master and members of the interface group can be invoked.
- Use cases: Deleted the extended field of the group description.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through the callback [ZIMGroupAttributesOperatedCallback] can delete the result of the group of attributes.
- Related APIs: You can use [setGroupAttributes] to setGroupAttributes, [queryGroupAttributes] to queryGroupAttributes, and [queryAllGroupAttributes] to queryAllGroupAttributes.
- Available since: 2.0.0 and above.
- Restrictions: Only group members can delete group attributes.
Return
Callback for the result of removing the group attributes.
queryGroupAttributes
void queryGroupAttributes(List\<String> keys, String groupID, ZIMGroupAttributesQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| keys | List<String> | The key of the group attribute to be queried. |
| groupID | String | The group ID of the group attribute to be queried. |
| callback | ZIMGroupAttributesQueriedCallback | Callback for the result of querying group attributes. |
Details
After a group is created, you can use this method to query the specified group attributes.
- Use cases: You need to query the scenarios to display the specified group attributes.
- When to call /Trigger: After creating a ZIM instance with [create] and logging in with [login].
- Related callbacks: Through the callback [ZIMGroupAttributesQuriedCallback] can get query attributes of the specified group of results.
- Related APIs: [queryAllGroupAttributes] Queries all group attributes.
- Available since: 2.0.0 and above.
- Restrictions: Available after login, unavailable after logout.
Return
Callback for the result of querying group attributes.
queryGroupAllAttributes
void queryGroupAllAttributes(String groupID, ZIMGroupAttributesQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupID | String | The group ID of all group attributes to be queried. |
| callback | ZIMGroupAttributesQueriedCallback | Callback for querying the result of all attributes of the group. |
Details
After a group is created, you can use this method to query all group attributes.
- Use cases: Scenarios where all group attributes need to be queried.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through callback can get query [ZIMGroupAttributesQuriedCallback] all the results of the group of attributes.
- Related APIs: [queryGroupAttributes] Queries the attributes of the specified group.
- Available since: 2.0.0 and above.
Return
Callback for querying the result of all attributes of the group.
setGroupMemberRole
void setGroupMemberRole(int role, String forUserID, String groupID, ZIMGroupMemberRoleUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| role | int | Set of group roles。 - 2: Administrator. - 3: Ordinary members. - Other values: The group role can be customized, and the permissions are the same as those of ordinary members. It is recommended that the value be greater than 100. |
| forUserID | String | User ID for which group role is set. |
| groupID | String | The group ID of the group role to be set. |
| callback | ZIMGroupMemberRoleUpdatedCallback | Callback to set the result of the group member role. |
Details
After a group is created, you can use this method to set the roles of group members.
- Use cases: The ZIM instance can be invoked after being created by [create] and logged in.
- When to call /Trigger: If the primary role of a group is 1 and the default role of other members is 3, you can invoke this interface to change the role.
- Caution: The role of the group owner is 1, the role of the administrator is 2, and the role of the normal member is 3. You can modify it by calling this interface, but the role cannot be changed to 1. If you need to customize the role, it is recommended to set the value to 100 or higher, and its permissions will be the same as those of normal members.
- Related callbacks: Through the callback [ZIMGroupMemberRoleUpdatedCallback] can be set up to get the results of the group of members of the role.
- Available since: 2.0.0 and above.
- Restrictions: Non-group master unavailable.
Return
Callback to set the result of the group member role.
setGroupMemberNickname
void setGroupMemberNickname(String nickname, String forUserID, String groupID, ZIMGroupMemberNicknameUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| nickname | String | Set member nickname. |
| forUserID | String | User ID for which group nickname is set. |
| groupID | String | The group ID of the group member's nickname is set. |
| callback | ZIMGroupMemberNicknameUpdatedCallback | Callback for the result of setting the group member's nickname. |
Details
After a group is created, you can use this method to set nicknames for group members.
- Use cases: Nicknames need to be set for group members.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Caution: A group member nickname can contain a maximum of 100 characters.
- Related callbacks: Through the callback [ZIMGroupMemberNicknameUpdatedCallback] can be set up to get the results of the group members nickname.
- Available since: 2.0.0 and above.
- Restrictions: Available after login, unavailable after logout. The owner of a group can change his or her own nickname, while the members can change only their own nickname.
Return
Callback for the result of setting the group member's nickname.
queryGroupMemberInfo
void queryGroupMemberInfo(String userID, String groupID, ZIMGroupMemberInfoQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userID | String | User ID of the queried member information. |
| groupID | String | The ID of the group whose member information will be queried. |
| callback | ZIMGroupMemberInfoQueriedCallback | Callback for the result of querying group member information. |
Details
After a group is created, you can use this method to query information about a specified group member.
- Use cases: You need to obtain the specified group member information for display or interaction.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through the callback [ZIMGroupMemberInfoQueriedCallback] can get the query specifies the result of group membership information.
- Available since: 2.0.0 and above.
- Restrictions: Available after login, unavailable after logout.
Return
Callback for the result of querying group member information.
queryGroupMemberList
void queryGroupMemberList(String groupID, ZIMGroupMemberQueryConfig config, ZIMGroupMemberListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupID | String | The group ID of the group member list to be queried. |
| config | ZIMGroupMemberQueryConfig | Group member query configuration. |
| callback | ZIMGroupMemberListQueriedCallback | Callback for querying the list of group members. |
Details
After a group is created, you can use this method to query the group member list.
- Use cases: You need to obtain the specified group member list for display or interaction.
- When to call /Trigger: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through the callback [ZIMGroupMemberListQueriedCallback] can query the result of the group member list.
- Available since: 2.0.0 and above.
- Restrictions: Available after login, unavailable after logout.
Return
Callback for querying the list of group members.
queryGroupMemberMutedList
void queryGroupMemberMutedList(String groupID, ZIMGroupMemberMutedListQueryConfig config, ZIMGroupMemberMutedListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupID | String | The group ID of the group muted member list to be queried. |
| config | ZIMGroupMemberMutedListQueryConfig | Group muted member query configuration. |
| callback | ZIMGroupMemberMutedListQueriedCallback | Callback for querying the list of group muted members. |
Details
After a group is created, you can use this method to query the group muted member list.
- Use cases: You need to obtain the specified group muted member list for display or interaction.
- When to call: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: Through the callback [ZIMGroupMembersMutedCallback] can query the result of the group muted member list.
- Available since: 2.14.0 and above.
- Restrictions: Available after login, unavailable after logout.
Return
Result for querying the list of group muted members.
queryGroupMemberCount
void queryGroupMemberCount(String groupID, ZIMGroupMemberCountQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| groupID | String | The group ID of the group to be queried. |
| callback | ZIMGroupMemberCountQueriedCallback | Callback for querying the number of groups. |
Details
Query the number of group members in a group.
- When to call: The ZIM instance can be invoked after being created by [create] and logged in.
- Related callbacks: [ZIMGroupMemberCountQueriedCallback].
- Available since: 2.2.0 or above.
- Restrictions: This function can only query the group that the user has entered.
Return
Callback for querying the number of groups.
queryConversation
void queryConversation(String conversationID, ZIMConversationType conversationType, ZIMConversationQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| conversationID | String | Conversation ID. |
| conversationType | ZIMConversationType | Conversation type. |
| callback | ZIMConversationQueriedCallback | Callback for conversation query. |
Details
This method displays the session list of the logged in user.
- Use cases: When you need to know the relevant information of the specified conversation, you can call this interface to obtain the data source.
- When to call /Trigger: Can be invoked after login.
- Related callbacks: [ZIMConversationQueriedCallback].
- Available since: 2.8.0 and above.
- Restrictions: There is no limit to the frequency of use, available after login, unavailable after logout.
Return
Callback of the query conversation result.
queryConversationList
void queryConversationList(ZIMConversationQueryConfig config, ZIMConversationListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMConversationQueryConfig | Configuration for session queries. |
| callback | ZIMConversationListQueriedCallback | Callback for session query. |
Details
This method displays the session list of the logged in user.
- Use cases: This interface can be invoked to get the data source when you need to display an existing message session after logging in.
- When to call /Trigger: Can be invoked after login.
- Caution: NextConversation is the riveting point of the query message, which can be null for the first query. In subsequent query, the earliest conversation can be used as nextConversation to query earlier sessions. In paging query, Count in [ZIMConversationQueryConfig] fill each pull the number of sessions.
- Related callbacks: [ZIMConversationListQueriedCallback].
- Related APIs: [deleteConversation] Deletes the session. [clearConversationUnreadMessageCount] clear session readings.
- Available since: 2.0.0 and above.
- Restrictions: There is no limit to the frequency of use, available after login, unavailable after logout.
Return
Callback of the query conversation list result.
queryConversationList
void queryConversationList(ZIMConversationQueryConfig config, ZIMConversationFilterOption option, ZIMConversationListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMConversationQueryConfig | Configuration for session queries. |
| option | ZIMConversationFilterOption | Filter options for conversation list query. |
| callback | ZIMConversationListQueriedCallback | Callback for conversation queried. |
Details
This method allows you to query the conversation list of the logged-in user based on filter criteria.
- Use cases: This interface can be invoked to get the data source when you need to display an existing message conversation after logging in.
- When to call /Trigger: Can be invoked after login.
- Caution: NextConversation is the riveting point of the query message, which can be null for the first query. In subsequent query, the earliest conversation can be used as nextConversation to query earlier sessions. In paging query, Count in [ZIMConversationQueryConfig] fill each pull the number of sessions.
- Related callbacks: [ZIMConversationListQueriedCallback].
- Available since: 2.17.0 and above.
- Restrictions: There is no limit to the frequency of use, available after login, unavailable after logout.
Return
Callback of the query conversation list result.
queryConversationPinnedList
void queryConversationPinnedList(ZIMConversationQueryConfig config, ZIMConversationPinnedListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMConversationQueryConfig | Configuration for session queries. |
| callback | ZIMConversationPinnedListQueriedCallback | Callback for conversation pinned list query. |
Details
This method displays the pinned conversation list of the logged in user.
- Use cases: This interface can be invoked to get the data source when you need to display an existing pinned message conversation after logging in.
- When to call /Trigger: Can be invoked after login.
- Caution: NextConversation is the riveting point of the query message, which can be null for the first query. In subsequent query, the earliest conversation can be used as nextConversation to query earlier sessions. In paging query, Count in [ZIMConversationQueryConfig] fill each pull the number of sessions.
- Available since: 2.8.0 and above.
- Restrictions: There is no limit to the frequency of use, available after login, unavailable after logout.
queryConversationTotalUnreadMessageCount
void queryConversationTotalUnreadMessageCount(ZIMConversationTotalUnreadMessageCountQueryConfig config, ZIMConversationTotalUnreadMessageCountQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMConversationTotalUnreadMessageCountQueryConfig | Configuration for conversation total unread message count queries. |
| callback | ZIMConversationTotalUnreadMessageCountQueriedCallback | Callback for conversation total unread message count queried. |
Details
his method can query the total number of unread messages in the conversations of the logged-in user according to the configuration items.
- Use cases: This interface can be invoked to get the data source when you need to display an existing message conversation after logging in.
- When to call /Trigger: Can be called after logging in.
- Related callbacks: [ZIMConversationTotalUnreadMessageCountQueriedCallback].
- Available since: 2.17.0 and above.
- Restrictions: There is no limit on the frequency of use; it is available after logging in and not available after logging out.
Return
Callback for conversation total unread message count queried.
updateConversationPinnedState
void updateConversationPinnedState(boolean isPinned, String conversationID, ZIMConversationType conversationType, ZIMConversationPinnedStateUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| isPinned | boolean | Whether the conversation is pinned, true is pinned, false is unpinned. |
| conversationID | String | Conversation ID. |
| conversationType | ZIMConversationType | Conversation type. |
| callback | ZIMConversationPinnedStateUpdatedCallback | Callback for updating the pinned state of the conversation. |
Details
This method can modify the pinned state of the specified conversation of the logged-in user.
- Use cases: You can call this interface when you need to modify the pinned state of a conversation.
- When to call /Trigger: Can be invoked after login.
- Related callbacks: [ZIMConversationPinnedStateUpdatedCallback].
- Available since: 2.8.0 and above.
- Restrictions: Available after login, unavailable after logout.
deleteAllConversations
void deleteAllConversations(ZIMConversationDeleteConfig config, ZIMConversationsAllDeletedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMConversationDeleteConfig | delete all conversation's configuration. |
| callback | ZIMConversationsAllDeletedCallback | Callback to delete all conversations. |
Details
This interface is invoked when all conversations needs to be deleted. All members in conversations can invoke this interface.
- Use cases: If you want to delete all conversations when they are no longer needed, you can call this interface implementation.
- When to call /Trigger: his parameter is invoked when conversations needs to be deleted and can be invoked after a ZIM instance is created. The call takes effect after login and becomes invalid after logout.
- Impacts on other APIs: If deleted conversations include unread message will trigger the [onConversationTotalUnreadMessageCountUpdated] callback, the call is successful at login, and the other end will trigger [onConversationsAllDeleted] callback.
- Related callbacks: [ZIMConversationsAllDeletedCallback]
- Available since: 2.12.0 and above.
Return
Callback of delete conversations result.
deleteConversation
void deleteConversation(String conversationID, ZIMConversationType conversationType, ZIMConversationDeleteConfig config, ZIMConversationDeletedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| conversationID | String | conversationID. |
| conversationType | ZIMConversationType | conversationtype. |
| config | ZIMConversationDeleteConfig | delete the session's configuration. |
| callback | ZIMConversationDeletedCallback | Callback to delete session. |
Details
This interface is invoked when a session needs to be deleted. All members in the session can invoke this interface.
- Use cases: You can invoke this interface implementation to delete an entire session when it is no longer needed.
- When to call /Trigger: his parameter is invoked when a session needs to be deleted and can be invoked after a ZIM instance is created. The call takes effect after login and becomes invalid after logout.
- Impacts on other APIs: A successful call triggers the deleteConversation callback. If the deleted conversation contains unread messages, the [onConversationTotalUnreadMessageCountUpdated] callback is triggered.
- Related callbacks: [ZIMConversationDeletedCallback]
- Available since: 2.0.0 and above.
Return
Callback of the delete conversation result.
setConversationDraft
void setConversationDraft(String draft, String conversationID, ZIMConversationType conversationType, ZIMConversationDraftSetCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| draft | String | Text message draft. |
| conversationID | String | conversationID. |
| conversationType | ZIMConversationType | Conversation type. Only Support peer and group conversations |
| callback | ZIMConversationDraftSetCallback | Callback to set session draft. |
Details
When you need to set a draft for a session, call this interface, and members of the session can call this interface.
- Use cases: This interface can be invoked when you need to temporarily save the text message that the user is editing but has not yet sent.
- When to call /Trigger: Call when you need to set session draft, call after creating ZIM instance, take effect after login, invalid after logout.
- Impacts on other APIs: A successful call triggers the [onConversationchanged] callback.
- Related callbacks: [ZIMConversationDraftSetCallback]
- Available since: 2.14.0 and above.
Return
Callback to set session draft.
clearConversationTotalUnreadMessageCount
void clearConversationTotalUnreadMessageCount(ZIMConversationTotalUnreadMessageCountClearedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| callback | ZIMConversationTotalUnreadMessageCountClearedCallback | Callback to remove all conversation unreads. |
Details
Used to clear unread for all conversations.
- Use cases: You can call this interface when you need to clear all unread conversations to zero.
- When to call /Trigger: Called when all conversation readings need to be cleared.
- Impacts on other APIs: Calling this method will trigger a total readings not updated callback [onConversationTotalUnreadMessageCountUpdated].
- Related callbacks: [ZIMConversationTotalUnreadMessageCountClearedCallback].
- Related APIs: [onConversationTotalUnreadMessageCountUpdated].
- Available since: 2.12.0 and above.
- Restrictions: Valid after login, invalid after logout.
Return
Callback to remove all conversation unreads result.
clearConversationUnreadMessageCount
void clearConversationUnreadMessageCount(String conversationID, ZIMConversationType conversationType, ZIMConversationUnreadMessageCountClearedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| conversationID | String | conversationID. |
| conversationType | ZIMConversationType | conversation type. |
| callback | ZIMConversationUnreadMessageCountClearedCallback | Callback to remove session unreads. |
Details
Used to clear unread for the current user target session.
- Use cases: This interface is called when a chat page is entered from a session and the original message readings of the session need to be cleared.
- When to call /Trigger: Called when a target needs to be cleared without readings.
- Impacts on other APIs: Calling this method will trigger a total readings not updated callback [conversationTotalUnreadMessageCountUpdated], would trigger a session to update callbacks [conversationChanged].
- Related callbacks: [ZIMConversationUnreadMessageCountClearedCallback].
- Related APIs: [conversationTotalUnreadMessageCountUpdated]、[conversationChanged].
- Available since: 2.0.0 and above.
- Restrictions: Valid after login, invalid after logout.
Return
Callback of the clear conversation unread message count result.
setConversationMark
void setConversationMark(Integer markType, boolean enable, ArrayList<ZIMConversationBaseInfo> conversationInfos, ZIMConversationMarkSetCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| markType | Integer | Mark type. The value range is [1, 20]. |
| enable | boolean | True is used to set a flag, while false is used to unset a flag. |
| conversationInfos | ArrayList<ZIMConversationBaseInfo> | List of brief information of conversations that need to be modified conversation tags. Up to 100 conversations can be passed in. |
| callback | ZIMConversationMarkSetCallback | Callback for setting conversation mark. |
Details
This method can set marks for the conversation.
- Use cases: When you need to implement custom business logic based on conversation marks.
- Default value: The conversation marks defaults to empty.
- When to call: When logged in and a valid conversation exists, if you want to set or unset mark for the target conversation, call this interface.
- Related callbacks: [ZIMConversationMarkSetCallback]。
- Available since: 2.17.0 and above.
- Restrictions: The range for setting marks is [1, 20]. A maximum of 100 conversations are supported for marking at one time.
Return
Callback for setting conversation mark.
setConversationNotificationStatus
void setConversationNotificationStatus(ZIMConversationNotificationStatus status, String conversationID, ZIMConversationType conversationType, ZIMConversationNotificationStatusSetCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| status | ZIMConversationNotificationStatus | the session notification state. |
| conversationID | String | Conversation ID. Currently, only "group" conversations and "peer"(only for 2.14.0 or above version) conversations can be set by notification state. For group conversations, the conversation ID is the group ID. For single chat conversations, the conversation ID is the user ID of the other party. |
| conversationType | ZIMConversationType | conversation type. Currently, only "group" conversations and "peer"(only for 2.14.0 or above version) conversations can be set by notification state. |
| callback | ZIMConversationNotificationStatusSetCallback | Callback for setting session notification status. |
Details
This method enables DND by selecting whether the unread of the target session is updated when a message is received.
- Use cases: If the user selects MESSAGE DO not Disturb (DND), the user can call the corresponding method.
- Default value: Message DND is disabled by default.
- When to call /Trigger: If the target session exists after login, invoke this interface if you want to enable the DND status of the target session.
- Impacts on other APIs: After the DND state is enabled, receiving messages is not triggered [onConversationTotalUnreadMessageCountUpdated]。
- Related callbacks: [ZIMConversationNotificationStatusSetCallback]。
- Related APIs: [onConversationTotalUnreadMessageCountUpdated]。
- Available since: 2.0.0 and above.
- Restrictions: Valid after login, invalid after logout.
Return
Callback of the set conversation notification status result.
cancelSendingMessage
void cancelSendingMessage(ZIMMessage message, ZIMSendingMessageCancelConfig config, ZIMSendingMessageCancelledCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message to be cancel sending. |
| config | ZIMSendingMessageCancelConfig | Related configuration for cancel sending messages. |
| callback | ZIMSendingMessageCancelledCallback | Callback of the cancel sending result of the message. |
- Related APIs: [queryHistoryMessage], [sendMessage].
Return
Callback of the cancel sending result of the message.
editMessage
void editMessage(ZIMMessage message, ZIMMessageEditConfig config, ZIMMessageSentFullCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message to be editing. |
| config | ZIMMessageEditConfig | Related configuration for editing messages. |
| callback | ZIMMessageSentFullCallback | Callback of the editing result of the message. |
- Related APIs: [queryHistoryMessage], [sendMessage].
Return
Callback of the editing result of the message.
pinMessage
void pinMessage(ZIMMessage message, boolean isPinned, ZIMMessagePinnedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message to be pinned or unpinned. |
| isPinned | boolean | To pin or unpin. |
| callback | ZIMMessagePinnedCallback | Callback of the result of the message to be pinned or unpinned. |
- Related callbacks: [ZIMMessagePinnedCallback], [onMessagePinStatusChanged].
- Related APIs: [queryPinnedMessageList], [sendMessage].
Return
Callback of the result of the message to be pinned or unpinned.
sendMessage
void sendMessage(ZIMMessage message, String toConversationID, ZIMConversationType conversationType, ZIMMessageSendConfig config, ZIMMessageSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message to be sent. |
| toConversationID | String | The conversation ID the message needs to be sent. |
| conversationType | ZIMConversationType | Conversation type, supports single chat, room and group chat. |
| config | ZIMMessageSendConfig | Related configuration for sending messages. |
| callback | ZIMMessageSentCallback | Callback of the sending result of the message. |
- Related APIs: [queryHistoryMessage], [deleteAllMessage], [deleteMessages],[sendMediaMessage]。
sendMediaMessage
void sendMediaMessage(zim_handle handle, ZIMMediaMessage message, String toConversationID, ZIMConversationType conversationType, ZIMMessageSendConfig config, ZIMMessageSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| handle | zim_handle | The handle of the instance. |
| message | ZIMMediaMessage | When using the message to be sent, modify the type of message according to the type of multimedia message. For example, when sending image messages, use ZIMImageMessage. |
| toConversationID | String | The conversation ID of the message recipient, supports single chat, room and group chat. |
| conversationType | ZIMConversationType | Conversation type, supports single chat, room and group chat. |
| config | ZIMMessageSendConfig | Related configuration for sending messages. |
| callback | ZIMMessageSentCallback | Result callback for sending media messages. |
- Impacts on other APIs: [onReceivePeerMessage]/[ReceiveGroupMessage] sessions and session-scoped [onReceiveGroupMessage] sessions did not fire message receiver's [ConversationR] fires [onversationTotalUnreadMessageCountUpdated] objection.
Only required if you need to use the threaded update feature when pushing configuration. Push notifications are not supported, nor are [onContationChanged] and [ConTotalUnreadMessageCountUpdated] supported if media messages are broadcast to the world.
- Related callbacks: [ZIMMessageSentCallback], [ZIMMediaMessageSendNotification], [onReceivePeMessage], [onReceiveRoomMessage], [onReceiveGroupMessage], [onConversationChanged], [onConversationTotalUnreadMessageCountUpdated].
- Related APIs: [queryHistoryMessage], [deleteAllMessage], [deleteMessages]
Return
Result for sending media messages.
insertMessageToLocalDB
void insertMessageToLocalDB(ZIMMessage message, String conversationID, ZIMConversationType conversationType, String senderUserID, ZIMMessageInsertedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message to be sent. |
| conversationID | String | Conversation ID. |
| conversationType | ZIMConversationType | Conversation type. |
| senderUserID | String | The sender ID of this message. |
| callback | ZIMMessageInsertedCallback | The result callback of the inserted message. |
Details
This method can insert a message directly to the local DB on the client side.
- Use cases: The developer can combine the system message type, and convert the callback notification (for example, invite someone into the group, remove someone from the group, etc.) to the system message type on the client side and insert it into the local DB to achieve the effect of the system prompt .
- When to call: It can be called after login.
- Caution: Inserting "command" messages is not supported. To insert a "room" message, upgrade the SDK to 2.13.0 and above.
- Related callbacks: [ZIMMessageInsertedCallback].
- Related APIs: [queryHistoryMessage], [deleteAllMessage], [deleteMessages].
- Available since: 2.4.0 and above.
Return
The result of the inserted message.
clearLocalFileCache
void clearLocalFileCache(ZIMFileCacheClearConfig config, ZIMFileCacheClearedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMFileCacheClearConfig | Clear the cache configuration. |
| callback | ZIMFileCacheClearedCallback | Return the result of clearing the cache. |
- Related callbacks: [ZIMFileCacheClearedCallback].
- Restrictions: This takes effect after the login and becomes invalid after the logout.
queryLocalFileCache
void queryLocalFileCache(ZIMFileCacheQueryConfig config, ZIMFileCacheQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMFileCacheQueryConfig | Query the cache configuration. |
| callback | ZIMFileCacheQueriedCallback | Return the result of the query cache. |
- Related callbacks: [ZIMFileCacheQueriedCallback].
- Restrictions: This takes effect after the login and becomes invalid after the logout.
exportLocalMessages
void exportLocalMessages(String folderPath, ZIMMessageExportConfig config, ZIMMessageExportingProgress progress, ZIMMessageExportedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| folderPath | String | Please enter the file saving address, the path is an absolute path. |
| config | ZIMMessageExportConfig | Export the configuration of the message. |
| progress | ZIMMessageExportingProgress | Return of export message progress. |
| callback | ZIMMessageExportedCallback | Return the result of the exported message. |
- Caution: The name of the message file exported by this interface is zim_backup_msg_text. If the passed in path is the same when calling this interface multiple times, the ZIM SDK will rename the old zim_backup_msg_text file by itself to ensure that the latest exported file name is zim_backup_msg_text.
- Related callbacks: [ZIMMessageExportedCallback].
- Restrictions: It takes effect after login and becomes invalid after logout.
importLocalMessages
void importLocalMessages(String folderPath, ZIMMessageImportConfig config, ZIMMessageImportingProgress progress, ZIMMessageImportedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| folderPath | String | Enter the address of the directory where the imported file resides. The path is an absolute path, excluding the file name. |
| config | ZIMMessageImportConfig | Import the configuration of the message. |
| progress | ZIMMessageImportingProgress | Return of import message progress. |
| callback | ZIMMessageImportedCallback | Return the result of the imported message. |
- Caution: The ZIM SDK reads a file named zim_backup_msg_text in the directory by default. If there are multiple backups in this path, please confirm whether the name of the file to be imported is zim_backup_msg_text.
- Related callbacks: [ZIMMessageImportedCallback].
- Restrictions: It takes effect after login and becomes invalid after logout.
sendConversationMessageReceiptRead
void sendConversationMessageReceiptRead(String conversationID, ZIMConversationType conversationType, ZIMConversationMessageReceiptReadSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| conversationID | String | Conversation ID. |
| conversationType | ZIMConversationType | Conversation type, only Peer type is supported. |
| callback | ZIMConversationMessageReceiptReadSentCallback | Set Conversation read callback. |
Details
Set all received receipts of the conversation to be read.
- Use cases: Set all received receipt messages in the entire conversation to be read, and the sender of the message receipt in the conversation will receive the [onConversationMessageReceiptChanged] callback from ZIMEventHandler.
- When to call: It can be called after login. It is recommended to call before entering the message list page. In the message list page, it is recommended to call [sendMessageReceiptsRead] to batch set the messages that need to be read.
- Caution: Only single chat conversation are allowed.
Related callback: [ZIMConversationMessageReceiptReadSentCallback].
- Related APIs: [sendMessageReceiptsRead], [sendMessage].
- Available since: 2.5.0 and above.
Return
Set Conversation read callback.
sendMessageReceiptsRead
void sendMessageReceiptsRead(List<ZIMMessage> messageList, String conversationID, ZIMConversationType conversationType, ZIMMessageReceiptsReadSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| messageList | List<ZIMMessage> | The list of messages to be read with no more than 10 messages. |
| conversationID | String | Conversation ID. |
| conversationType | ZIMConversationType | Conversation type. |
| callback | ZIMMessageReceiptsReadSentCallback | Set the result callback of the read message. |
Details
This method can set the receipt of a batch of messages to become read.
- Use cases: Developers can use this method to set a batch of messages with receipts that have been read. If the sender is online, it will receive the [onMessageReceiptChanged] callback.
- When to call: Callable after login. It is recommended to set the settings for the messages that need to be read on the message list page. It is not recommended to mix with [sendConversationMessageReceiptRead].
- Related callbacks: [ZIMMessageReceiptsReadSentCallback].
- Related APIs: [sendMessage].
- Available since: 2.5.0 and above.
- Restrictions: Only support the settings for received messages with receipt status as PROCESSING.
Return
Set the result callback of the read message.
queryMessageReceiptsInfo
void queryMessageReceiptsInfo(List<ZIMMessage> messageList, String conversationID, ZIMConversationType conversationType, ZIMMessageReceiptsInfoQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| messageList | List<ZIMMessage> | list of messages to query. |
| conversationID | String | Conversation ID. |
| conversationType | ZIMConversationType | Conversation type. |
| callback | ZIMMessageReceiptsInfoQueriedCallback | Callback for the result of querying message receipt information. |
Details
This method can query the receipt information of a batch of messages, including the status, the number of unread users and the number of read users.
- Use cases: If you need to query the receipt status of the message, the number of unread users and the number of read users, you can call this interface.
- When to call: Callable after login. If you need to query the detailed member list, you can query through the interface [queryGroupMessageReceiptReadMemberList] or [queryGroupMessageReceiptUnreadMemberList].
- Related callbacks: [ZIMMessageReceiptsInfoQueriedCallback].
- Related APIs: [queryGroupMessageReceiptReadMemberList] , [queryGroupMessageReceiptUnreadMemberList].
- Available since: 2.5.0 and above.
- Restrictions: Only messages whose statuses are not NONE are supported.
Return
Callback for the result of querying message receipt information.
queryGroupMessageReceiptReadMemberList
void queryGroupMessageReceiptReadMemberList(ZIMMessage message, String groupID, ZIMGroupMessageReceiptMemberQueryConfig config, ZIMGroupMessageReceiptMemberListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | list of messages to query. |
| groupID | String | Group ID. |
| config | ZIMGroupMessageReceiptMemberQueryConfig | query configuration. |
| callback | ZIMGroupMessageReceiptMemberListQueriedCallback | Query the result callback of the specific read member list. |
Details
This method can query the specific read member list of a message sent by a group.
- Use cases: Developers can use this method to query the specific read member list of a message they send.
- When to call: Callable after login.
- Related callbacks: [ZIMGroupMessageReceiptMemberListQueriedCallback].
- Related APIs: If you need to query the receipt status of a certain message or only need to query the read/unread count, you can query through the interface [queryMessageReceiptsInfo].
- Available since: 2.5.0 and above.
- Restrictions: only supports querying the messages sent by the local end, and the receipt status of the messages is not NONE. If the user is not in the group, or has been kicked out of the group, the corresponding member list cannot be found.
Return
Query the result callback of the specific read member list.
queryGroupMessageReceiptUnreadMemberList
void queryGroupMessageReceiptUnreadMemberList(ZIMMessage message, String groupID, ZIMGroupMessageReceiptMemberQueryConfig config, ZIMGroupMessageReceiptMemberListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | Message to query |
| groupID | String | Group ID. |
| config | ZIMGroupMessageReceiptMemberQueryConfig | query configuration |
| callback | ZIMGroupMessageReceiptMemberListQueriedCallback | Query the result callback of the specific read member list. |
Details
This method can query the specific unread member list of a message sent by a group.
- Use cases: Developers can use this method to query the specific unread member list of a message they send.
- When to call: Callable after login.
- Related callbacks: [ZIMGroupMessageReceiptMemberListQueriedCallback].
- Related APIs: If you need to query the receipt status of a certain message or only need to query the read/unread count, you can query through the interface [queryMessageReceiptsInfo].
- Available since: 2.5.0 and above.
- Restrictions: only supports querying the messages sent by the local end, and the receipt status of the messages is not NONE. If the user is not in the group, or has been kicked out of the group, the corresponding member list cannot be found.
Return
Query the result callback of the specific read member list.
searchLocalMessages
void searchLocalMessages(String conversationID, ZIMConversationType conversationType, ZIMMessageSearchConfig config, ZIMMessagesSearchedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| conversationID | String | The conversation ID of the local message to be search. |
| conversationType | ZIMConversationType | conversation type. |
| config | ZIMMessageSearchConfig | Search the configuration of local messages. |
| callback | ZIMMessagesSearchedCallback | Callback of the search local message result. |
- Related callbacks: [ZIMMessagesSearchedCallback].
- Restrictions: Effective after login, invalid after logout. Searching is not supported in the room scene (conversationType=1).
Return
Callback of the search local message result.
searchLocalConversations
void searchLocalConversations(ZIMConversationSearchConfig config, ZIMConversationsSearchedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMConversationSearchConfig | Global search conversation config. |
| callback | ZIMConversationsSearchedCallback | Callback of the search conversations result. |
- Related callbacks: [ZIMConversationsSearchedCallback].
- Restrictions: effective after logging in and becomes invalid after logging out. Searching is not supported in room scenarios (conversationType=1).
Return
Callback of the search conversations message result.
searchGlobalLocalMessages
void searchGlobalLocalMessages(ZIMMessageSearchConfig config, ZIMMessagesGlobalSearchedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMMessageSearchConfig | Search global the configuration of local messages. |
| callback | ZIMMessagesGlobalSearchedCallback | Callback of the search global local message result. |
- Related callbacks: [ZIMMessagesGlobalSearchedCallback].
- Restrictions: Effective after login, invalid after logout. Searching global is not supported in the room scene (conversationType=1).
Return
Callback of the search global local message result.
replyMessage
void replyMessage(ZIMMessage message, ZIMMessage toOriginalMessage, ZIMMessageSendConfig config, ZIMMessageSentFullCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message to be sent. Only supports: ZIMTextMessage(1), ZIMImageMessage(11), ZIMFileMessage(12), ZIMAudioMessage(13), ZIMVideoMessage(14), ZIMCombineMessage(100), ZIMCustomMessage(200)." |
| toOriginalMessage | ZIMMessage | The source message to be quoted. Only supports: ZIMTextMessage(1), ZIMImageMessage(11), ZIMFileMessage(12), ZIMAudioMessage(13), ZIMVideoMessage(14), ZIMCombineMessage(100), ZIMCustomMessage(200)." |
| config | ZIMMessageSendConfig | Related configuration for sending messages. |
| callback | ZIMMessageSentFullCallback | Callback of the sending result of the message. |
- Related APIs: [queryHistoryMessage], [sendMessage], [sendMediaMessage].
queryMessageRepliedList
void queryMessageRepliedList(ZIMMessage message, ZIMMessageRepliedListQueryConfig config, ZIMMessageRepliedListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | Any message in the reply list. |
| config | ZIMMessageRepliedListQueryConfig | query configuration |
| callback | ZIMMessageRepliedListQueriedCallback | The query result callback. |
Details
Query the reply message list.
- Use cases: Developers can use this method to query the entire reply message tree.
- When to call: Callable after login.
- Available since: 2.17.0 and above.
Return
The query result callback.
sendMediaMessage
void sendMediaMessage(ZIMMediaMessage message, String toConversationID, ZIMConversationType conversationType, ZIMMessageSendConfig config, ZIMMediaMessageSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMediaMessage | The message to be sent. |
| toConversationID | String | The conversation ID of the message recipient, supports single chat, room and group chat. |
| conversationType | ZIMConversationType | Conversation type, supports single chat, room and group chat. |
| config | ZIMMessageSendConfig | Related configuration for sending messages. |
| callback | ZIMMediaMessageSentCallback | Result callback for sending media messages. |
Details
Supported versions: 2.1.0 and above.
Detailed description: This method can be used to send messages in single chat, room and group chat.
Business scenario: When you need to send media to the target user, target message room, and target group chat after logging in, send it through this interface.
Call timing/Notification timing: It can be called after login.
Usage limit: no more than 10/s, available after login, unavailable after logout.
Impact: [onReceivePeerMessage]/[ReceiveGroupMessage] sessions and session-scoped [onReceiveGroupMessage] sessions did not fire message receiver's [ConversationR] fires [onversationTotalUnreadMessageCountUpdated] objection.
Only required if you need to use the threaded update feature when pushing configuration. Push notifications are not supported, nor are [onContationChanged] and [ConTotalUnreadMessageCountUpdated] supported if media messages are broadcast to the world.
Related: [ZIMMessageSentCallback], [ZIMMediaUploadingProgress], [onReceivePeMessage], [onReceiveRoomMessage], [onReceiveGroupMessage], [onConversationChanged], [onConversationTotalUnreadMessageCountUpdated].
Related interfaces: [queryHistoryMessage], [deleteAllMessage], [deleteMessages]
Return
Result for sending media messages.
downloadMediaFile
void downloadMediaFile(ZIMMessage message, ZIMMediaFileType fileType, ZIMMediaDownloadConfig config, ZIMMediaDownloadedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The media file message to download. |
| fileType | ZIMMediaFileType | Media file type. |
| config | ZIMMediaDownloadConfig | Download the configuration object. |
| callback | ZIMMediaDownloadedCallback | Result callback for downloading media files. |
- Related callbacks: [ZIMMediaDownloadedCallback], [ZIMMediaDownloadingProgress].
- Restrictions: If you download an external URL, you can only download a maximum of 200MB of resources. For configuration, please contact ZEGO technical support.
Return
Result for downloading media files.
downloadMediaFile
void downloadMediaFile(ZIMMediaMessage message, ZIMMediaFileType fileType, ZIMMediaDownloadedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMediaMessage | The media message to download. |
| fileType | ZIMMediaFileType | Media file type. |
| callback | ZIMMediaDownloadedCallback | Result callback for downloading media files. |
- Related callbacks: [ZIMMediaDownloadedCallback], [ZIMMediaDownloadingProgress].
- Restrictions: If you download an external URL, you can only download a maximum of 200MB of resources. For configuration, please contact ZEGO technical support.
Return
Result for downloading media files.
sendPeerMessage
void sendPeerMessage(ZIMMessage message, String toUserID, ZIMMessageSendConfig config, ZIMMessageSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message to be sent. |
| toUserID | String | The ID of the user who will receive the message. |
| config | ZIMMessageSendConfig | Related configuration for sending single chat messages. |
| callback | ZIMMessageSentCallback | Callback of the sending result of the message. |
Details
After this function is called, a message is sent to the specified user. At the same time, a [onMessageSent] callback is received, which can be used to determine whether the message is sent successfully.
- Use cases: This function is used in 1V1 chat scenarios.
- Caution: Be aware of the [onMessageSent] callback when sending. This callback can be used to determine if the send fails for some reason.
- Available since: 1.1.0 or above.
Return
Callback of the sending result of the message.
sendRoomMessage
void sendRoomMessage(ZIMMessage message, String toRoomID, ZIMMessageSendConfig config, ZIMMessageSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message to be sent. |
| toRoomID | String | The ID of the room which will receive the message. |
| config | ZIMMessageSendConfig | Related configuration for sending room messages. |
| callback | ZIMMessageSentCallback | Callback of the sending result of the message. |
Details
When this function is called, the message will be sent in the room. At the same time, the [onMessageSent] callback will be received, which can be used to determine whether the message was sent successfully.
Use Cases: This feature is required for scenarios where multiple people in the room are chatting.
- Available since: 1.1.0 or above
Return
Callback of the sending result of the message.
sendGroupMessage
void sendGroupMessage(ZIMMessage message, String toGroupID, ZIMMessageSendConfig config, ZIMMessageSentCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message to be sent. |
| toGroupID | String | The ID of the user who will receive the message. |
| config | ZIMMessageSendConfig | Related configuration for sending single chat messages. |
| callback | ZIMMessageSentCallback | Callback of the sending result of the message. |
Details
This interface is invoked when a group chat message needs to be sent.
Service scenario: This interface can be used when sending group messages.
Call timing/Notification timing: This interface is called when a group chat message needs to be sent.
Usage restrictions: No more than 10 pieces /s, available after login, unavailable after logout.
pushconfig is only required to use the offline push function.
Scope of influence: Using this method triggers the onReceiveGroupMessage callback of the message recipient and the onConversationChanged callback of the sender and receiver. If messages are not set for the session where the message resides, Trigger onConversationTotalUnreadMessageCountUpdated callback.
The callback: [ZIMMessageSentCallback]、[onReceiveGroupMessage]、[onConversationChanged]、[onConversationTotalUnreadMessageCountUpdated].
Relevant interface: [queryHistoryMessage], [deleteMessage].
Return
Callback of the sending result of the message.
queryHistoryMessage
void queryHistoryMessage(String conversationID, ZIMConversationType conversationType, ZIMMessageQueryConfig config, ZIMMessageQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| conversationID | String | The session ID of the queried historical message. |
| conversationType | ZIMConversationType | conversation type. |
| config | ZIMMessageQueryConfig | Query the configuration of historical messages. |
| callback | ZIMMessageQueriedCallback | Returns the result of querying historical messages. |
- Related callbacks: [ZIMMessageQueriedCallback].
- Restrictions: Effective after login, invalid after logout. In the default room scenario (conversationType=1), offline message is disabled. If you need to enable it, please contact the corresponding technical support.
Return
Callback of the query history message result.
queryPinnedMessageList
void queryPinnedMessageList(String conversationID, ZIMConversationType conversationType, ZIMMessageQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| conversationID | String | The conversation ID of the queried pinned message. |
| conversationType | ZIMConversationType | conversation type. |
| callback | ZIMMessageQueriedCallback | Returns the result of querying historical messages. |
- Related callbacks: [ZIMPinnedMessageListQueriedCallback].
- Restrictions: The SDK must be logged in and the message pinning feature must be supported to use this interface.
Return
Callback of the query pinned message result.
queryMessages
void queryMessages(ArrayList<Long> messageSeqs, String conversationID, ZIMConversationType conversationType, ZIMMessageQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| messageSeqs | ArrayList<Long> | The message seq list to be queried. |
| conversationID | String | The conversation ID of the queried message. |
| conversationType | ZIMConversationType | conversation type. |
| callback | ZIMMessageQueriedCallback | Returns the result of querying messages. |
Details
Supported versions: 2.17.0 and above.
Detailed description: Query a batch of messages based on the message seq list.
Business scenario: Jump to the source message location quoted by the reply message on the chat page.
Return
Returns the result of querying messages.
deleteAllConversationMessages
void deleteAllConversationMessages(ZIMMessageDeleteConfig config, ZIMConversationMessagesAllDeletedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZIMMessageDeleteConfig | Delete the configuration of the message. |
| callback | ZIMConversationMessagesAllDeletedCallback | Return the result of deleting all messages for all sessions. |
- Impacts on other APIs: Call the interface trigger [onMessageDeleted] callback, if there are unread messages at this time, will trigger [onConversationTotalUnreadMessageCountUpdated] callback.
- Related callbacks: [ZIMConversationMessagesAllDeletedCallback]、[onMessageDeleted]、[onConversationTotalUnreadMessageCountUpdated].
- Restrictions: Effective after login.
Return
Return the result of deleting all messages for all conversations.
queryCombineMessageDetail
public void queryCombineMessageDetail(ZIMCombineMessage message, ZIMCombineMessageDetailQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMCombineMessage | The combine message needs querying message list. |
| callback | ZIMCombineMessageDetailQueriedCallback | Callback parameters for querying merge message details. |
- Use cases: If you need to obtain the specific sub-messages under the combine message, you can call this API to query.
- Restrictions: You can only use it after logging in.
Return
Returns the result of querying combine message detail.
revokeMessage
void revokeMessage(ZIMMessage message, ZIMMessageRevokeConfig config, ZIMMessageRevokedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message needs to be revoke. |
| config | ZIMMessageRevokeConfig | Revoke the configuration of the message. |
| callback | ZIMMessageRevokedCallback | Returns the result of revoking the message. |
- Use cases: The user needs to recall a message. This method can be used when the user does not want other users to see the message.
- When to call: Called when the message needs to be revoked.
Room message revoke is not supported.
- Related callbacks: If the revoked message is the latest message of the session, the [conversationChanged] callback will be triggered, and if the message is unread, the [conversationTotalUnreadMessageCountUpdated] callback will be triggered.
- Restrictions: Login is required to use. To revoke messages from other members within the group, the group owner needs to use version 2.9.0 or above.
Return
Returns the result of revoking the message.
deleteMessages
void deleteMessages(List<ZIMMessage> messageList, String conversationID, ZIMConversationType conversationType, ZIMMessageDeleteConfig config, ZIMMessageDeletedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| messageList | List<ZIMMessage> | List of deleted messages. |
| conversationID | String | The session ID of the deleted message. |
| conversationType | ZIMConversationType | conversation type. |
| config | ZIMMessageDeleteConfig | Delete the configuration of the message. |
| callback | ZIMMessageDeletedCallback | Returns the result of deleting the message. |
- Impacts on other APIs: If the deleted message is the latest message of the session, the [conversationChanged] callback will be triggered, and if the message is unread, the [conversationTotalUnreadMessageCountUpdated] callback will be triggered.
- Related callbacks: [ZIMMessageDeletedCallback]、[conversationChanged]、[conversationTotalUnreadMessageCountUpdated].
- Restrictions: Effective after login.
Return
Returns the result of deleting the message.
addMessageReaction
void addMessageReaction(String reactionType, ZIMMessage message, ZIMMessageReactionAddedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| reactionType | String | Type of reaction, defined by you, with a maximum length of 32 bytes. |
| message | ZIMMessage | The message needs reaction. |
| callback | ZIMMessageReactionAddedCallback | Returns the result of adding message reaction. |
- Use cases: Users need to express their position on a certain message, such as liking, and this method can be used to express their position.
Room message reaction is not supported.
- Related callbacks: If the addition is successful, the [onMessageReactionsChanged] callback will be triggered. If the reaction is made to the latest message in the conversation, the [onConversationChanged] callback will be triggered when the addition is successful.
- Restrictions: You can only use it after logging in. And only supports message reactions for single chat and group chat
Return
Returns the result of adding reaction.
deleteMessageReaction
void deleteMessageReaction(String reactionType, ZIMMessage message, ZIMMessageReactionDeletedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| reactionType | String | Reaction type. It must be the type of reaction made by the local user. |
| message | ZIMMessage | The message needs reaction delete. |
| callback | ZIMMessageReactionDeletedCallback | Returns the result of revoking the message. |
- Use cases: Users need to delete the status of a message that has already been stated, which can be done using this method.
Room message reaction is not supported.
- Related callbacks: If the deletion is successful, the [onMessageReactionsChanged] callback will be triggered. If the reaction is deleted from the latest message in the conversation, the [onConversationChanged] callback will be triggered when the addition is successful.
- Restrictions: You can only use it after logging in. And only supports message statements for single chat and group chat
Return
Returns the result of deleting reaction.
queryMessageReactionUserList
public void queryMessageReactionUserList(ZIMMessage message, ZIMMessageReactionUserQueryConfig config, ZIMMessageReactionUserListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| message | ZIMMessage | The message needs querying reaction user list. |
| config | ZIMMessageReactionUserQueryConfig | reaction user query config. |
| callback | ZIMMessageReactionUserListQueriedCallback | the result of querying reaction user list. |
- Use cases: When it is necessary to obtain specific user information under a certain state of a message, this interface can be called to query state user messages in a paginated manner.
- Restrictions: You can only use it after logging in. And only supports message statements for single chat and group chat
Return
Returns the result of querying reaction user list.
deleteAllMessage
void deleteAllMessage(String conversationID, ZIMConversationType conversationType, ZIMMessageDeleteConfig config, ZIMMessageDeletedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| conversationID | String | The session ID of the message to be deleted. |
| conversationType | ZIMConversationType | conversation type. |
| config | ZIMMessageDeleteConfig | delete session configuration. |
| callback | ZIMMessageDeletedCallback | Returns the result of deleting a message by session ID. |
- Impacts on other APIs: The [conversationChanged] callback is triggered, and if there are unread messages, the [conversationTotalUnreadMessageCountUpdated] callback is triggered.
- Related callbacks: [ZIMMessageDeletedCallback].
- Restrictions: Effective after login, invalid after logout.
The impact of deleting messages is limited to this account, and messages from other accounts will not be deleted.
Return
Returns the result of deleting the message.
updateMessageLocalExtendedData
void updateMessageLocalExtendedData(String localExtendedData, ZIMMessage message, ZIMMessageLocalExtendedDataUpdatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| localExtendedData | String | The expandable message field visible only on this end can store additional information locally and currently has a length limit of 128K. If you have special requirements, please contact ZEGO technical support for configuration. |
| message | ZIMMessage | Message body to be updated |
| callback | ZIMMessageLocalExtendedDataUpdatedCallback | Callback function to modify local extension fields. |
Details
After the user logs in, calling this interface allows updating the local expandable field of the message.
- When to call: After the user is logged in.
- Privacy reminder: Please avoid passing sensitive personal information, including but not limited to phone numbers, ID card numbers, passport numbers, real names, etc.
- Related callbacks: [ ZIMMessageLocalExtendedDataUpdatedCallback ].
- Available since: 2.2.0 or above.
Return
The result of the update user extended data.
createRoom
void createRoom(ZIMRoomInfo roomInfo, ZIMRoomCreatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomInfo | ZIMRoomInfo | The configuration information of the room to be created. |
| callback | ZIMRoomCreatedCallback | Callback of the result of creating the room. |
Details
Users can create and join rooms through this api, other users can join this room through [joinRoom] function.
- Use cases: When you need to create a multi-person chat scene, you can create and join a room by this API.
- When to call: It can be called after creating a ZIM instance through [create].
- Caution: When everyone leaves the room, the room will be automatically destroyed. If the room already exists, an error will occur when calling this API. For details, please refer to the returned error code handling.
- Related callbacks: The result of the room creation can be obtained through the [ZIMRoomCreatedCallback] callback.
- Related APIs: You can join the room through [joinRoom] and leave the room with [leaveRoom].
- Available since: 1.1.0 or above.
queryRoomMembers
void queryRoomMembers(ArrayList\<String\> userIDs, String roomID, ZIMRoomMembersQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | List of user IDs to query. |
| roomID | String | The room ID of the specified room. |
| callback | ZIMRoomMembersQueriedCallback | Callback for querying room user information. |
Details
This method can query the information of up to ten users in the specified room of the logged-in user.
- Use cases: When you need to know the user information in the specified room, you can call this interface to obtain the data source.
- When to call /Trigger: Can be invoked after login.
- Available since: 2.8.0 and above.
- Restrictions: Available after login, unavailable after logout, up to ten users can be queried at one time.
setRoomMembersAttributes
void setRoomMembersAttributes(HashMap<String, String> attributes, ArrayList<String> userIDs, String roomID, ZIMRoomMemberAttributesSetConfig config, ZIMRoomMembersAttributesOperatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| attributes | HashMap<String, String> | Room member attributes to be set. |
| userIDs | ArrayList<String> | A list of userIDs to set. |
| roomID | String | Room ID. |
| config | ZIMRoomMemberAttributesSetConfig | Behavior configuration of the operation. |
| callback | ZIMRoomMembersAttributesOperatedCallback | Action callback for setting room members attributes. |
Details
Supported Versions: 2.4.0 and above.
Detail description: Call this API to set room user properties of members in the room.
Business scenario: If you need to set a level for members in the room, you can use this interface to set a state.
Default: [ZIMRoomMemberAttributesSetConfig] Default constructor isDeleteAfterOwnerLeft is true.
Call timing: After logging in and calling in the relevant room.
Usage limit: A maximum of 500 user attributes can be set in each room and stored in the key-value mode. If you need to increase the attribute limit, please contact ZEGO technical support. The total length of user attribute key-values owned by each user in a room cannot exceed 144 bytes, and the number of key-values cannot exceed 30 pairs. The length of a single key-value cannot exceed 8 bytes for a Key and 64 bytes for a Value. If you need to raise the cap, please contact ZEGO technical support. After the room is destroyed, the user-defined user properties are also destroyed.
Relevant callbacks: [ZIMRoomMembersAttributesOperatedCallback],[onRoomMemberAttributesUpdated].
Related interfaces: [queryRoomMembersAttributes], [queryRoomMemberAttributesList].
Return
Operation result for setting room members attributes.
queryRoomMembersAttributes
void queryRoomMembersAttributes(ArrayList<String> userIDs, String roomID, ZIMRoomMembersAttributesQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| userIDs | ArrayList<String> | A list of userIDs to query. |
| roomID | String | Room ID. |
| callback | ZIMRoomMembersAttributesQueriedCallback | Callback for the result of batch query of room user attributes. |
Details
Call this API to batch query the room user attributes of the members in the room.
- Use cases: Use this interface when you need to specify that you want to query some room users.
- Related callbacks: [ZIMRoomMembersAttributesQueriedCallback].
- Related APIs: [setRoomMembersAttributes]、[queryRoomMemberAttributesList].
- Runtime lifecycle: It is available after logging in and joining the corresponding room, but unavailable after leaving the corresponding room.
- Available since: 2.4.0 or later.
- Restrictions: The maximum call frequency is 5 times within 30 seconds by default, and the maximum query time is 100 people.
Return
The result of batch query of room user attributes.
queryRoomMemberAttributesList
void queryRoomMemberAttributesList(String roomID, ZIMRoomMemberAttributesQueryConfig config, ZIMRoomMemberAttributesListQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | Room ID. |
| config | ZIMRoomMemberAttributesQueryConfig | Behavior configuration of the operation. |
| callback | ZIMRoomMemberAttributesListQueriedCallback | Result callback for querying member attributes in the room. |
Details
paginate the room user properties that have room property members in the room.
- Use cases: This interface is used when you need to query all room users.
- Related callbacks: [ZIMRoomMemberAttributesListQueriedCallback].
- Related APIs: [setRoomMembersAttributes]、[queryRoomMembersAttributes].
- Runtime lifecycle: It is available after logging in and joining the corresponding room, but unavailable after leaving the corresponding room.
- Available since: 2.4.0 or later.
- Restrictions: The maximum call frequency is 5 times within 30 seconds by default, and the maximum query time is 100 people.
Return
Result of paging query for room user properties.
createRoom
void createRoom(ZIMRoomInfo roomInfo, ZIMRoomAdvancedConfig config, ZIMRoomCreatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomInfo | ZIMRoomInfo | The configuration information of the room to be created. |
| config | ZIMRoomAdvancedConfig | The advanced properties of the room to be created. |
| callback | ZIMRoomCreatedCallback | Callback of the result of creating the room. |
Details
Users can create and join rooms through this api, other users can join this room through [joinRoom] function.
- Available since: 1.3.0.
Return
Callback of the result of creating the room.
enterRoom
void enterRoom(ZIMRoomInfo roomInfo, ZIMRoomAdvancedConfig config, ZIMRoomEnteredCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomInfo | ZIMRoomInfo | Configuration information for the room that will be created. Only the first user who enters the room creates roomName and takes effect. |
| config | ZIMRoomAdvancedConfig | Advanced properties of the room that will be created. Only the first user who enters the room is configured to take effect. |
| callback | ZIMRoomEnteredCallback | Callback of the result of entering the room. |
- When to call: It can be called after logging in.
When everyone leaves the room, the room will be automatically destroyed, and a user can be in a maximum of 5 rooms at the same time. [enterRoom] is equivalent to [createRoom] and [joinRoom], so you only need to choose one of the APIs.
- Related callbacks: The result of entering the room can be obtained through the [onRoomEntered] callback.
- Related APIs: You can enter the room through [enterRoom], and leave the room through [leaveRoom].
Return
Callback of the result of entering the room.
switchRoom
void switchRoom(String fromRoomID, ZIMRoomInfo toRoomInfo, boolean isCreateWhenRoomNotExisted, ZIMRoomAdvancedConfig config, ZIMRoomSwitchedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| fromRoomID | String | Configuration information for the room that will be created. Only the first user who enters the room creates roomName and takes effect. |
| toRoomInfo | ZIMRoomInfo | Basic information of the room to be switched to. The roomName field is only valid when the room to be switched to does not exist and the isCreateWhenRoomNotExisted field is true. |
| isCreateWhenRoomNotExisted | boolean | When the room to be switched to does not exist, decide whether to create the corresponding room based on this field. |
| config | ZIMRoomAdvancedConfig | If the isCreateWhenRoomNotExisted field is true and the room to be switched to does not exist, create the room advanced property configuration used by the corresponding room. |
| callback | ZIMRoomSwitchedCallback | Callback of the result of switching the room. |
- When to call: It can be called after logging in.
- Related callbacks: The result of switching the room can be obtained through the [ZIMRoomSwitchedCallback] callback.
Return
Callback of the result of switching the room.
joinRoom
void joinRoom(String roomID, ZIMRoomJoinedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | ID of the room to join. |
| callback | ZIMRoomJoinedCallback | Callback of the result of joining the room. |
Details
If the room does not exist, the join fails and you need to call [createRoom] to create the room first.
- Use cases: In a multi-person chat scenario, users can call this interface to enter the room when they need to join the room.
- When to call: It can be called after creating a ZIM instance through [create].
- Caution: When everyone leaves the room, the room will be automatically destroyed.
- Related callbacks: The result of joining the room can be obtained through the [onRoomJoined] callback.
- Related APIs: You can create a room with [createRoom] and leave the room with [leaveRoom].
- Available since: 1.1.0 or above.
Return
Callback of the result of joining the room
leaveRoom
void leaveRoom(String roomID, ZIMRoomLeftCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | ID of the room to leave. |
| callback | ZIMRoomLeftCallback | Callback of the result of leave the room. |
Details
When the user in the room needs to leave the room, use [leaveRoom] to leave the room. If the room does not exist, the leave fails.
- Use cases: In the multi-person chat scenario, when users in the room need to leave the room, they can leave the room through this interface.
- When to call: After creating a ZIM instance via [create], it can be called when the user is in the room.
- Caution: If the current user is not in this room, the exit fails. When everyone leaves the room, the room will be automatically destroyed.
- Related callbacks: The result of leaving the room can be obtained through the [onRoomLeft] callback.
- Related APIs: You can create a room through [createRoom] and join a room with [joinRoom].
- Available since: 1.1.0 or above.
Return
Callback of the result of leave the room.
leaveAllRoom
void leaveAllRoom(ZIMRoomAllLeftCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| callback | ZIMRoomAllLeftCallback | Leave all rooms results callback. |
Details
Call this interface to exit all rooms you have entered at once.
- When to call: Can be called after logging in.
- Related callbacks: Get the list of rooms left through the [ZIMRoomAllLeftCallback] callback.
- Available since: 2.15 and above.
Return
Callback for the results of leaving all rooms.
queryRoomMemberList
void queryRoomMemberList(String roomID, ZIMRoomMemberQueryConfig config, ZIMRoomMemberQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | ID of the room to query. |
| config | ZIMRoomMemberQueryConfig | Configuration of query room member operation. |
| callback | ZIMRoomMemberQueriedCallback | Callback for the result of querying room members list. |
Details
After joining a room, you can use this function to get the list of members in the room.
- Use cases: When a developer needs to obtain a list of room members for other business operations, this interface can be called to obtain a list of members.
- When to call: After creating a ZIM instance through [create], and the user is in the room that needs to be queried, you can call this interface.
- Caution: To use this feature, please contact ZEGOCLOUD technical support. If the user is not currently in this room, the query fails. When there are more than 500 room members, the result of querying the list of room members can only contain the information of a maximum of 500 members.
- Related callbacks: Through the [onMemberQueried] callback, you can get the result of querying the room member list.
- Related APIs: You can check the online number of people in the room through [queryRoomOnlineMemberCount].
- Available since: 1.1.0 or above.
Return
Callback for the result of querying room members list.
queryRoomOnlineMemberCount
void queryRoomOnlineMemberCount(String roomID, ZIMRoomOnlineMemberCountQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | ID of the room to query. |
| callback | ZIMRoomOnlineMemberCountQueriedCallback | Callback for the result of querying room online members count. |
Details
After joining a room, you can use this function to get the number of online members in the room.
- Use cases: When a developer needs to obtain the number of room members who are online, this interface can be called.
Calling time: After creating a ZIM instance through [create], and the user is in the room that needs to be queried, this interface can be called.
- Caution: If the user is not currently in this room, the query will fail.
- Related callbacks: The result of querying the online number of room members can be obtained through the [onRoomOnlineMemberCountQueried] callback.
- Related APIs: the room member can be inquired through [queryRoomMember].
- Available since: 1.1.0 or above.
Return
Callback for the result of querying room online members count.
queryRoomAllAttributes
void queryRoomAllAttributes(String roomID, ZIMRoomAttributesQueriedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | Need to query the room number of the custom attributes. |
| callback | ZIMRoomAttributesQueriedCallback | Callback for querying room attributes. |
Details
Used to query room attributes.
- Available since: 1.3.0.
Return
Callback for querying room attributes.
setRoomAttributes
void setRoomAttributes(HashMap<String, String> roomAttributes, String roomID, ZIMRoomAttributesSetConfig config, ZIMRoomAttributesOperatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomAttributes | HashMap<String, String> | Room attributes to be set. |
| roomID | String | To modify the room number of the room attribute. |
| config | ZIMRoomAttributesSetConfig | Behavior configuration of the operation. |
| callback | ZIMRoomAttributesOperatedCallback | Operation callback for setting room properties. |
Details
Used to set room properties.
- Use cases: This interface is used when you need to set the mic bit in a chat room.
- When to call /Trigger: after login, and in the relevant room to call.
- Default value: [ZIMRoomAttributesSetConfig] the space-time of the default configuration is optional, and do not update the owner, and involves the room properties in the owner is not automatically deleted after exit.
- Privacy reminder: Try not to introduce sensitive information related to personal privacy into the property of the room, including but not limited to mobile phone number, ID number, passport number, real name, etc.
Privacy reminder: Adds or modifies room properties to an existing room.
- Related callbacks: [ZIMRoomAttributesOperatedCallback].
- Related APIs: [DeleteRoomAttributes] to delete room attributes. [QueryRoomAllAttributes], queries the room attributes.
- Available since: 1.3.0.
- Restrictions: You can set a maximum of 20 properties per room.
Notice: Key-value of the room property. The default key length is 16 and the default value length is 1024.
Return
Operation callback for setting room properties.
deleteRoomAttributes
void deleteRoomAttributes(List\<String> keys, String roomID, ZIMRoomAttributesDeleteConfig config, ZIMRoomAttributesOperatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| keys | List<String> | The key of the room attribute to be deleted. |
| roomID | String | To modify the room number of the room attribute |
| config | ZIMRoomAttributesDeleteConfig | Behavior configuration of the operation. |
| callback | ZIMRoomAttributesOperatedCallback | Operation callback for setting room properties. |
Details
Used to delete room attributes.
- Available since: 1.3.0.
Return
Operation callback for setting room properties.
beginRoomAttributesBatchOperation
void beginRoomAttributesBatchOperation(String roomID, ZIMRoomAttributesBatchOperationConfig config)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | The number of the room where the combined operation needs to be turned on. |
| config | ZIMRoomAttributesBatchOperationConfig | The configuration of the combined operation. |
Details
Used to turn on the combination of room attributes.
- Available since: 1.3.0.
endRoomAttributesBatchOperation
void endRoomAttributesBatchOperation(String roomID, ZIMRoomAttributesBatchOperatedCallback callback)ZIM.javaParameters
| Name | Type | Description |
|---|---|---|
| roomID | String | To modify the room number of the room attribute. |
| callback | ZIMRoomAttributesBatchOperatedCallback | Callback for combined operation. |
Details
After completing the operation of combining room attributes, all the setting/deleting operations from the last call to beginRoomAttributesBatchOperation to this operation will be completed for the room.
- Available since: 1.3.0.
Return
Callback for combined operation.
ZIMAudio
Methods
getVersion
String getVersion()If you encounter an abnormality during the running of the SDK, you can submit the problem, log, and other information to the ZEGO technical staff to locate and troubleshoot. Developers can also collect current SDK version information through this API, which is convenient for App operation statistics and related issues.
- When to call: Any time.
- Available since: ZIM Audio SDK 1.0.0
SDK current version.
setAdvancedConfig
void setAdvancedConfig(String key, String value)Parameters
| Name | Type | Description |
|---|---|---|
| key | String | Key for advanced configuration. |
| value | String | Value for advanced configuration. |
Details
When the default behavior of the SDK cannot meet the developer's usage scenario, this API can be called to implement developer-defined advanced configuration.
-
When to call: Must be called before [init], otherwise it will only take effect after the next [init].
-
Caution: Please contact ZEGO technical support before use.
-
Available since: ZIM Audio SDK1.0.0
-
Restrictions: None.
getInstance
ZIMAudio getInstance()When using ZIMAudio SDK, developers should directly call this API to obtain the internal singleton object without creating and maintaining the object themselves.
- When to call: Any time.
- Available since: ZIM Audio SDK 1.0.0
init
void init(String license)Parameters
| Name | Type | Description |
|---|---|---|
| license | String | Authorization file. If only recording and playing audio, this field can be left empty. When advanced features such as volume gain and noise are required, this field needs to be passed. |
Details
When using other functional interfaces of ZIMAudio SDK, this API must be called first for initialization.
- When to call: Call before calling other APIs.
- Available since: ZIM Audio SDK 1.0.0
- Restrictions: When no authentication information is passed in or the authentication information is incorrect, the initialization of the SDK can proceed normally, but subsequent use of some functions that require authentication will be restricted.
uninit
void uninit()When you no longer need to use ZIMAudio SDK, you can call this API to deinitialize and release memory resources.
- Caution: None.
- Available since: ZIM Audio SDK 1.0.0
- Restrictions: None.
setEventHandler
void setEventHandler(ZIMAudioEventHandler eventHandler)Parameters
| Name | Type | Description |
|---|---|---|
| eventHandler | ZIMAudioEventHandler | Event notification callback. Developers should override callbacks to focus on specific notifications based on their own business scenarios. |
Details
Set event notification callbacks to monitor callbacks such as recorder and player life cycle events.
- When to call: After [init].
- Caution: When the API is called multiple times and different eventHandler objects are passed in, the last object will overwrite the previously set object; when the eventHandler object passed in by the API is empty, the event callback notification is cancelled.
- Available since: ZIM Audio SDK 1.0.0
enableANS
void enableANS(boolean enable)Parameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable this function. |
Details
After turning on this function, the human voice can be made clearer. This function is better at suppressing continuous noise (such as the sound of rain and other white noise).
Use case: This feature can be turned on when noise suppression is needed to improve the vocal quality and user experience of recorded audio.
- When to call: Called at the time after [init] and before [startPlay].
- Caution: This API can only be called normally after the authentication is within the legal usage period, or the use is allowed in the authentication information; otherwise, an error message will be reported that the authentication has expired or this feature is not supported.
- Available since: ZIM Audio SDK 1.0.0
enableAGC
void enableAGC(boolean enable)Parameters
| Name | Type | Description |
|---|---|---|
| enable | boolean | Whether to enable this function. |
Details
After turning on this function, the SDK can automatically adjust the microphone volume to adapt to far and near pickup and keep the volume stable.
Use case: This feature can be turned on when volume stability needs to be ensured to improve the vocal quality and user experience of recorded audio.
- When to call: Called at the time after [init] and before [startPlay].
- Caution: This API can only be called normally after the authentication is within the legal usage period, or the use is allowed in the authentication information; otherwise, an error message will be reported that the authentication has expired or this feature is not supported. =
- Available since: ZIM Audio SDK 1.0.0
setANSParam
void setANSParam(ZIMAudioANSParam param)Parameters
| Name | Type | Description |
|---|---|---|
| param | ZIMAudioANSParam | ANS parameter |
Details
When noise suppression is turned on using [enableANS], you can use this function to switch between different noise suppression modes to control the degree of noise suppression.
Use case: When the default noise suppression effect does not meet expectations, you can use this function to adjust the noise suppression mode.
- Default value: When this function is not called, the default noise suppression mode is [Medium].
- When to call: Called at any time after [init].
- Caution: This API can only be called normally after the license is within the legal usage period, or the use is allowed in the authentication information; otherwise, an error message will be reported that the authentication has expired or this feature is not supported.
- Available since: ZIM Audio SDK 1.0.0
- Restrictions: None.
startRecord
void startRecord(ZIMAudioRecordConfig config)Parameters
| Name | Type | Description |
|---|---|---|
| config | ZIMAudioRecordConfig | Audio recording configuration. |
Details
Start recording audio files. The SDK will apply to the system to use the microphone device to collect audio and write it to a local file. Use case: Before the user needs to send voice messages, they can call this API to collect and generate the voice files required for sending. The recording files will eventually be saved to the path set locally.
- When to call: After [init].
- Related APIs: When this API is called to start recording, the SDK will throw the [onRecorderStarted] notification. Only after receiving this callback notification can the developer consider that recording has officially started and updated the UI display; after that, the SDK will call back the recording progress through [onRecorderProgress]; under abnormal circumstances, the SDK may also throw an [onRecorderFailed] notification, please Developers may monitor and alert users when exceptions occur as appropriate.
- Caution: Developers are requested to ensure that they have obtained the audio collection permission of the app before using this API; when the SDK starts recording, it will exclusively have the right to use the audio device, so it will interrupt the playback and other behaviors of other third-party apps.
- Available since: ZIM Audio SDK 1.0.0
- Restrictions: Recording-related APIs cannot be used at the same time as playback-related APIs. At the same time, only recording or playback can be performed inside the SDK. Therefore, before you need to start recording, developers are required to actively stop the playback function, otherwise the playback-related functions will also be stopped before the SDK starts recording.
completeRecord
void completeRecord()Finish recording the audio file. After calling this API, the recording file will be generated in the file path passed in [startRecord] and saved.
Use case: After completing the recording, the developer can send the recording file as an IM message. For example, it is passed to ZIM's AudioMessage to send voice messages.
- When to call: [startRecord] Recording is taking effect.
- Related APIs: When this API is called and recording is successfully completed, the SDK throws the [onRecorderCompleted] notification. Developers must receive this callback notification before sending voice messages.
- Caution: If the developer does not call this API to end the recording while [startRecord] is in effect, the recording will still be completed and the file will be saved when the maximum recording duration of [startRecord] is reached. After completing the recording, the SDK will release the occupation of the audio device.
- Available since: ZIM Audio SDK 1.0.0
- Restrictions: Recording-related APIs cannot be used at the same time as playback-related APIs. At the same time, only recording or playback can be performed inside the SDK.
cancelRecord
void cancelRecord()Interrupt recording audio file. After calling this API, recording will be stopped, and the local file will be deleted internally by the SDK.
Use case: When you need to stop recording early during the recording process and do not need to send a voice message, you can call this API to cancel the recording.
- When to call: [startRecord] Recording is taking effect.
- Related APIs: When this API is called to cancel recording, the SDK will throw the [onRecorderCancelled] notification. Developers can clean up related resources and update UI display based on this notification.
- Caution: After canceling the recording, the SDK will release the occupation of the audio device.
- Available since: 1.0.0
- Restrictions: Recording-related APIs cannot be used at the same time as playback-related APIs. At the same time, only recording or playback can be performed inside the SDK.
isRecording
boolean isRecording()Get whether the SDK is recording at the current moment.
Use case: When developers need to obtain and detect the recording status at a certain moment,
they can call this API to obtain the recording status.
- When to call: Called at any time after [init].
- Available since: ZIM Audio SDK 1.0.0
setAudioRouteType
void setAudioRouteType(ZIMAudioRouteType routeType)Parameters
| Name | Type | Description |
|---|---|---|
| routeType | ZIMAudioRouteType | Route type. |
Details
Set the audio routing type to choose whether to use speakers or earpieces to play audio.
Use case: When developers need to have the option for users to choose where the sound is played from, they can call this API to change the audio routing type currently being played.
- When to call: Called at any time after [init].
- Caution: When the user is currently using headphones for audio playback, the settings of this API will not take effect.
- Available since: ZIM Audio SDK 1.0.0
- Restrictions: None.
startPlay
void startPlay(ZIMAudioPlayConfig config)Parameters
| Name | Type | Description |
|---|---|---|
| config | ZIMAudioPlayConfig | Audio playing configuration. |
Details
Start playing the audio file. The SDK will read the audio file in the specified path and play it.
Use case: After the user receives the voice message, the API can be called to play the audio file that has been downloaded and saved locally.
- When to call: After [init].
- Related APIs: When this API is called to start playback, the SDK will throw the [onPlayerStarted] notification. Only after receiving this callback notification can the developer consider that playback has officially started and update the UI display; after that, the SDK will call back the playback progress through [onPlayerProgress]; under abnormal circumstances, the SDK may also throw an [onPlayerFailed] notification, please Developers may monitor and alert users when exceptions occur as appropriate.
- Caution: When the SDK starts playing, it will exclusively use the audio device, so it will interrupt the playback of other third-party apps and will not mix with the audio output of other apps.
- Available since: ZIM Audio SDK 1.0.0
- Restrictions: Playback-related APIs cannot be used at the same time as recording-related APIs. At the same time, only recording or playback can be performed inside the SDK. Therefore, before you need to enable playback, developers must first ensure that the recording function is not being used at this time, otherwise playback will fail.
stopPlay
void stopPlay()Stops the audio currently being played by the SDK. Use case: When you need to stop audio playback in advance during playback, you can call this API to stop playback. If the user needs to immediately play the next piece of audio, he needs to stop the playback of the previous piece of audio; or when he is about to leave the playback page, he should also stop the current playback.
- When to call: [startPlay] During playback.
- Related APIs: When this API is called to stop playback, the SDK will throw the [onPlayerStopped] notification. Developers can update the UI display based on this callback notification.
- Caution: After stopping playback or completing playback, the SDK will release the occupation of the audio device.
- Available since: ZIM Audio SDK 1.0.0
- Restrictions: Playback-related APIs cannot be used at the same time as recording-related APIs. At the same time, only recording or playback can be performed inside the SDK. Therefore, before you need to enable playback, developers must first ensure that the recording function is not being used at this time, otherwise playback will fail.
isPlaying
boolean isPlaying()Get whether ZIM Audio SDK is playing audio. Use case: When developers need to obtain and detect the playback status at a certain moment, they can call this API to obtain the playback status.
- When to call: Called at any time after [init].
- Available since: ZIM Audio SDK 1.0.0
ZIMAudioEventHandler
Methods
onError
void onError(ZIMAudioError errorInfo)Parameters
| Name | Type | Description |
|---|---|---|
| errorInfo | ZIMAudioError | Error information. |
Details
When an exception is detected internally in the SDK, a notification will be thrown through this callback.
Use case: It is used to facilitate developers to collect SDK problems and troubleshoot them. It is recommended to monitor the callback and do appropriate log printing or event reporting.
- Caution: It is not recommended that developers perform logic after listening to this callback. It is only recommended for collecting and troubleshooting problems.
- Available since: ZIM Audio SDK1.0.0
onRecorderStarted
void onRecorderStarted()When the developer calls [startRecord] and the SDK has internally prepared the audio device and is about to start recording, the notification will be called back.
Use case: Used by developers to update the UI.
- Related APIs: The notification will be called back after [startRecord] is called.
- Caution: None.
- Available since: ZIM Audio SDK 1.0.0
onRecorderCompleted
void onRecorderCompleted(int totalDuration)Parameters
| Name | Type | Description |
|---|---|---|
| totalDuration | int | Audio duration (in milliseconds). |
Details
When the developer calls [completeRecord] and the SDK completes the recording and saves the recording file, the notification will be called back.
Use case: Used by developers to update the UI and send subsequent voice messages.
- Related APIs: The notification will be called back after [completeRecord] is called.
- Caution: Developers must receive this callback notification before sending voice messages.
- Available since: ZIM Audio SDK 1.0.0
onRecorderCancelled
void onRecorderCancelled()When the developer calls [cancelRecord] and the SDK stops recording and deletes the recording file, this notification will be called back.
Use case: Used by developers to update the UI.
- Related APIs: The notification will be called back after [cancelRecord] is called.
- Caution: None.
- Available since: 1.0.0
onRecorderProgress
void onRecorderProgress(int currentDuration)Parameters
| Name | Type | Description |
|---|---|---|
| currentDuration | int | Current recording duration in milliseconds. |
Details
Recording progress notification. When recording has started, the SDK will callback progress notifications every 500 milliseconds. Use case: Used by developers to update the UI.
- Caution: None.
- Available since: ZIM Audio SDK v1.0.0
onRecorderFailed
void onRecorderFailed(ZIMAudioErrorCode errorCode)Parameters
| Name | Type | Description |
|---|---|---|
| errorCode | ZIMAudioErrorCode | Error Code. |
Details
When recording starts or an exception occurs during recording and the recording fails, this callback will be used to notify you.
Use case: Used by developers to update the UI. It is recommended that developers listen to this callback and provide necessary prompts to users.
- Caution: None.
- Available since: ZIM Audio SDK 1.0.0
onPlayerStarted
void onPlayerStarted(int totalDuration)Parameters
| Name | Type | Description |
|---|---|---|
| totalDuration | int | Total playing duration in milliseconds. |
Details
When the developer calls [startPlay] and the SDK has internally prepared the audio device and is about to start playing, the notification will be called back.
Use case: Used by developers to update the UI.
- Related APIs: The notification will be called back after [startPlay] is called.
- Caution: None.
- Available since: ZIM Audio SDK 1.0.0
onPlayerEnded
void onPlayerEnded()When the playing is finished, the notification will be called back.
Use case: Used by developers to update the UI.
- Caution: None.
- Available since: ZIM Audio SDK 1.0.0
onPlayerStopped
void onPlayerStopped()When the developer calls [stopPlay], the SDK will immediately stop the currently playing audio and call back this notification.
Use case: Used by developers to update the UI.
- Related APIs: The notification will be called back after [stopPlay] is called.
- Caution: None.
- Available since: ZIM Audio SDK 1.0.0
onPlayerProgress
void onPlayerProgress(int currentDuration)Parameters
| Name | Type | Description |
|---|---|---|
| currentDuration | int | Current playing duration in milliseconds. |
Details
When playback has started, the SDK will call back progress notifications every 500ms.
Use case: Used by developers to update the UI.
- Caution: None.
- Available since: ZIM Audio SDK 1.0.0
onPlayerInterrupted
void onPlayerInterrupted()When playback is interrupted by other actions, the SDK will call back this notification. For example, recording is started during playback, an incoming call event from the system is received during playback, the audio device is preempted by other apps during playback, etc.
Use case: Used by developers to update the UI.
- Caution: None.
- Available since: ZIM Audio SDK 1.0.0
onPlayerFailed
void onPlayerFailed(ZIMAudioErrorCode errorCode)Parameters
| Name | Type | Description |
|---|---|---|
| errorCode | ZIMAudioErrorCode | Error Code. |
Details
When playback starts or an exception occurs during playback and the playback fails, this callback will be used to notify you.
Use case: Used by developers to update the UI. It is recommended that developers listen to this callback and provide necessary prompts to users.
- Caution: None.
- Available since: ZIM Audio SDK 1.0.0
ZIMEventHandler
Details
Callback.
Declared in callback/ZIMEventHandler.java
Methods
onBlacklistChanged
void onBlacklistChanged(ZIM zim, ArrayList<ZIMUserInfo> userList, ZIMBlacklistChangeAction action)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| userList | ArrayList<ZIMUserInfo> | The collection of user information changes in the blacklist. |
| action | ZIMBlacklistChangeAction | When receiving changes to the blacklist, this value can be used to determine whether it's a deletion action or an addition action. |
- When to call: After creating a ZIM instance through [create].
- Related APIs: [addUsersToBlacklist].
onFriendListChanged
void onFriendListChanged(ZIM zim, ArrayList<ZIMFriendInfo> friendInfoList, ZIMFriendListChangeAction action)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| friendInfoList | ArrayList<ZIMFriendInfo> | The collection of user information changes in the friend list. |
| action | ZIMFriendListChangeAction | When receiving changes to the friend list, this value can be used to determine whether it's a deletion action or an addition action. |
- When to call: After creating a ZIM instance through [create].
- Related APIs: [addFriend].
onFriendApplicationListChanged
void onFriendApplicationListChanged(ZIM zim, ArrayList<ZIMFriendApplicationInfo> friendApplicationInfoList, ZIMFriendApplicationListChangeAction action)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| friendApplicationInfoList | ArrayList<ZIMFriendApplicationInfo> | The data of the friend application list changes. |
| action | ZIMFriendApplicationListChangeAction | When receiving changes to the friend list, this value can be used to determine whether it's a deletion action or an addition action." |
- When to call: After creating a ZIM instance through [create].
- Related APIs: [sendFriendApplication].
onFriendApplicationUpdated
void onFriendApplicationUpdated(ZIM zim, ArrayList<ZIMFriendApplicationInfo> friendApplicationInfoList)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| friendApplicationInfoList | ArrayList<ZIMFriendApplicationInfo> | Data of the friend request list update. |
- When to call: After creating a ZIM instance through [create].
- Related APIs: [acceptFriendApplication] [rejectFriendApplication]。
onFriendInfoUpdated
void onFriendInfoUpdated(ZIM zim, ArrayList<ZIMFriendInfo> friendInfoList)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| friendInfoList | ArrayList<ZIMFriendInfo> | Data of friend information update. |
- When to call: After creating a ZIM instance through [create].
- Related APIs: [updateFriendAlias] [updateFriendAttributes]。
onUserStatusUpdated
void onUserStatusUpdated(ZIM zim, ArrayList<ZIMUserStatus> userStatusList)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | zim instance. |
| userStatusList | ArrayList<ZIMUserStatus> | A list with data about the user's online status. |
Details
User online status change notification.
- Use cases: This callback can be used when you needs to pay attention to the online status of certain users, for example, the online group members need to be displayed. After subscribing to users through the subscribeUsersStatus method, the online status of the targeted users and the changes of their online status during the validity period of the subscription will be notified to you through this callback.
- When to call /Trigger: After the current user subscribes to the target user for the first time, the event will be triggered if the target user is added to the subscription list for the first time, or the subscribed user's online status or online platform list. In addition, the callback will also be triggered if the current user has opened a multi-terminal login and the online platform has changed.
- Available since: 2.18.0
- Restrictions: When the userStatusUpdated callback returns the userStatus information of the current user, the onlineStatus will be unknown and the lastUpdateTime will be 0, which cannot truly present the online status. Map the online status of the current user according to connectionStateChanged.
onError
callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| errorInfo | ZIMError | Error information, please refer to the error codes document. |
Details
When an EXCEPTION occurs in the SDK, the callback prompts detailed exception information.
- Use cases: It is recommended that developers listen for this callback notification and print the error information to the console during debugging after accessing the SDK, so that they can learn about the errors occurred during development and modify them in time.
- When to call: When an error occurs within the SDK, the SDK notifies the developer through this function callback.
- Available since: 1.1.0 or above.
onConnectionStateChanged
void onConnectionStateChanged(ZIM zim, ZIMConnectionState state, ZIMConnectionEvent event, JSONObject extendedData)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| state | ZIMConnectionState | The current connection state after changed. |
| event | ZIMConnectionEvent | The event that caused the connection state to change. |
| extendedData | JSONObject | Extra information when the event occurs, a standard JSON format data. |
Details
When the connection status changes, the user will be notified of the current status and events through this callback.
- Use cases: The [ZIMConnectionState] and [ZIMConnectionEvent] in this callback can be used to accomplish different business logic when you need to monitor the connection state and the events that cause the connection state to change.
- When to call: This function is called back when connection state changes.
- Available since: 1.1.0 or above.
onTokenWillExpire
void onTokenWillExpire(ZIM zim, int second)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| second | int | The remaining second before the token expires, the unit is seconds. |
Details
When receiving this callback, the developer should call the [renewToken] function to update the Token in time.
- Use cases: When the authentication Token has only 30 seconds left, the SDK calls back this function to notify the developer to update the authentication Token. If the validity period of the authentication Token passed by the developer when [login] is less than 30 seconds, the authentication Token will be recalled after [login] is successful.
- When to call: For details, see authentication Token Generation https://doc-zh.zego.im/article/11617.
- Available since: 1.1.0 or above.
onUserInfoUpdated
void onUserInfoUpdated(ZIM zim, ZIMUserFullInfo info)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| info | ZIMUserFullInfo | Updated user information. |
Details
In the multi-terminal login scenario, after the user modifies their information on device A, other online multi-terminal devices will receive this callback. For offline devices, after the user goes online, they need to call the [queryUsersInfo] interface to actively query user information.
- Available since: 2.11.0 or above.
onUserRuleUpdated
void onUserRuleUpdated(ZIM zim, ZIMSelfUserRule userRule)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| userRule | ZIMSelfUserRule | Updated user rule information. |
Details
Callback of user rule changes.
When to
- Trigger: When the user rule of the current user is changed, all users are notified by the callback.
- Available since: 2.15.0 and later versions.
onCallInvitationReceived
void onCallInvitationReceived(ZIM zim, ZIMCallInvitationReceivedInfo info, String callID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| info | ZIMCallInvitationReceivedInfo | Information about received call invitations. |
| callID | String | Received CallID. |
- When to call: After creating a ZIM instance through [create].
If the user is not in the invitation list or not online, this callback will not be called.
- Related APIs: [callInvite].
onCallInvitationCreated
void onCallInvitationCreated(ZIM zim, ZIMCallInvitationCreatedInfo info, String callID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| info | ZIMCallInvitationCreatedInfo | Information about created call invitations. |
| callID | String | Created CallID. |
- When to call: After creating a ZIM instance through [create].
- Related APIs: [callInvite].
onCallInvitationCancelled
void onCallInvitationCancelled(ZIM zim, ZIMCallInvitationCancelledInfo info, String callID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| info | ZIMCallInvitationCancelledInfo | Information about canceled call invitations. |
| callID | String | Cancelled callID. |
- When to call: After creating a ZIM instance through [create].
If the user is not in the cancel invitation list or is offline, this callback will not be called.
- Related APIs: [callCancel].
onCallInvitationTimeout
void onCallInvitationTimeout(ZIM zim, ZIMCallInvitationTimeoutInfo info, String callID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| info | ZIMCallInvitationTimeoutInfo | Information class about timeout notifications. |
| callID | String | The callID of the timeout. |
- When to call: After creating a ZIM instance through [create].
If the user is not on the invitation list or is not online, the callback will not be received.
- Related APIs: [callInvite], [callAccept], [callReject].
onCallInvitationAccepted
void onCallInvitationAccepted(ZIM zim, ZIMCallInvitationAcceptedInfo info, String callID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| info | ZIMCallInvitationAcceptedInfo | Information about the call invitation. |
| callID | String | The accepted callID. |
- When to call: After creating a ZIM instance through [create].
This callback will not be called if the user is not online.
- Related APIs: [callAccept].
onCallInvitationRejected
void onCallInvitationRejected(ZIM zim, ZIMCallInvitationAcceptedInfo info, String callID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| info | ZIMCallInvitationAcceptedInfo | Information about rejected call invitations. |
| callID | String | The callID of the rejected call invitation. |
Details
This callback will be received when the inviter is online after the inviter rejects the call invitation.
- Use cases: The inviter will receive this callback after the inviter declines the call invitation.
- Default value: After creating a ZIM instance through [create] and logging in.
- When to call /Trigger: After creating a ZIM instance through [create] and logging in.
- Related APIs: [callReject].
- Available since: 2.0.0 and above.
- Restrictions: If the user is not the inviter of the call invitation or is not online, the callback will not be received.
onCallInviteesAnsweredTimeout
void onCallInviteesAnsweredTimeout(ZIM zim, ArrayList\<String> invitees)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| invitees | ArrayList<String> | Timeout invitee ID. |
- When to call: After creating a ZIM instance through [create].
If the user is not the inviter who initiated this call invitation or is not online, the callback will not be received.
- Related APIs: [callInvite], [callAccept], [callReject].
onCallInvitationEnded
void onCallInvitationEnded(ZIM zim, ZIMCallInvitationEndedInfo info, String callID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| info | ZIMCallInvitationEndedInfo | Information carried by the event callback. |
| callID | String | Timeout invitee ID. |
- Related APIs: [callEnd]
onCallUserStateChanged
void onCallUserStateChanged(ZIM zim, ZIMCallUserStateChangeInfo info, ArrayList\<String> callID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| info | ZIMCallUserStateChangeInfo | Information about the status change of a call member. |
| callID | ArrayList<String> | Unique identifier of the call. |
- When to call: When a new member is invited to a call, or a member accepts, rejects, exits, or a member response times out, all users on the current call invitation whose status is "Inviting," "Accepted," and "Received" receive the callback here. If the member is not online at the time of notification, the call is still ongoing when the login succeeds. The status changes of all members during the offline period will be sent to the user at one time.
If the user is not the inviter who initiated this call invitation or is not online, the callback will not be received.
- Related APIs: [callInvite], [callingInvite], [callAccept], [callReject],[callQuit].
onGroupStateChanged
void onGroupStateChanged(ZIM zim, ZIMGroupState state, ZIMGroupEvent event, ZIMGroupOperatedInfo operatedInfo, ZIMGroupFullInfo groupInfo)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| state | ZIMGroupState | The status of the group after the change. |
| event | ZIMGroupEvent | Group related events. |
| operatedInfo | ZIMGroupOperatedInfo | Group information that has been operated. |
| groupInfo | ZIMGroupFullInfo | Information about group status changes. |
Details
allback notification of group status change.
- Use cases: Scenarios that require interaction based on the group status.
- When to call /Trigger: A notification is triggered when a group is created, joined, left, or dismissed.
- Related APIs: [createGroup] : creates a group. [joinGroup] : joins a group. [leaveGroup], leave the group. [dismissGroup]; dismiss the group.
onGroupAliasUpdated
void onGroupAliasUpdatedcallback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| groupAlias | String | The updated group alias. |
| operatedUserID | String | The userID of who modifies the group alias. |
| groupID | String | The target group ID. |
Details
Group alias change notification callback.
- Use cases: When the group alias is changed, this notification synchronizes the latest group alias to all devices of the user who made the modification.
When to
- Trigger: The group alias is changed.
- Related APIs: [updateGroupAlias].
onGroupNameUpdated
void onGroupNameUpdatedcallback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| groupName | String | The updated group name. |
| operatedInfo | ZIMGroupOperatedInfo | Operation information after the group name is updated. |
| groupID | String | The groupID where the group name update occurred. |
Details
Group name change notification callback.
- Use cases: If the group name is changed, you need to synchronize the latest group name.
- When to call /Trigger: The group name is changed. Procedure
- Related APIs: [updateGroupName] : updates the group name.
onGroupAvatarUrlUpdated
void onGroupAvatarUrlUpdated(ZIM zim, String groupAvatarUrl, ZIMGroupOperatedInfo operatedInfo, String groupID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| groupAvatarUrl | String | The updated group avatar URL. |
| operatedInfo | ZIMGroupOperatedInfo | The operation information after the group avatar URL is updated. |
| groupID | String | The groupID where the group name update occurred. |
- Related APIs: [updateGroupAvatarUrl], update group avatar URL.
onGroupNoticeUpdated
void onGroupNoticeUpdatedcallback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| groupNotice | String | Updated group announcement. |
| operatedInfo | String | The group announces the updated operation information. |
| groupID | String | The groupID where the group announcement update occurred. |
Details
Group bulletin Change notification callback.
- Use cases: If a group bulletin changes, you need to synchronize the latest bulletin content.
- When to call /Trigger: The group bulletin is changed. Procedure
- Related APIs: [updateGroupNotice], which updates the group notice.
onGroupMutedInfoUpdated
void onGroupMutedInfoUpdated(ZIM zim, ZIMGroupMuteInfo muteInfo, String operatedInfo, String groupID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| muteInfo | ZIMGroupMuteInfo | Group mute info. |
| operatedInfo | String | Operation information for changes in group mute. |
| groupID | String | The groupID where the group mute change occurred. |
Details
Callback notification for changes in group mute information.
- Use cases: To know the details of changes when group mute information changes.
When to trigger: When group mute information changes.
- Related APIs: [muteGroup], Group Mute.
onGroupVerifyInfoUpdated
void onGroupVerifyInfoUpdated(ZIM zim, ZIMGroupVerifyInfo verifyInfo, ZIMGroupOperatedInfo operatedInfo, String groupID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| verifyInfo | ZIMGroupVerifyInfo | Group verification mode info. |
| operatedInfo | ZIMGroupOperatedInfo | Operation information for changes in group verification mode. |
| groupID | String | The groupID where the group verification mode change occurred. |
Details
Callback notification for changes in group verification mode.
When to trigger: When group verification mode changes.
- Related APIs: [updateGroupJoinMode, updateGroupInviteMode, updateGroupBeInviteMode], Update the group verification mode.
onGroupAttributesUpdated
void onGroupAttributesUpdated(ZIM zim, ArrayList<ZIMGroupAttributesUpdateInfo> infos, ZIMGroupOperatedInfo operatedInfo, String groupID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| infos | ArrayList<ZIMGroupAttributesUpdateInfo> | Information after group attribute update. |
| operatedInfo | ZIMGroupOperatedInfo | Operation information after the group attribute is updated. |
| groupID | String | The groupID for sending group attribute updates. |
Details
Group attribute change notification callback.
- Use cases: When group attributes are changed, you need to synchronize the latest group attributes.
- When to call /Trigger: Triggered when group properties are set, updated, or deleted.
- Related APIs: [setGroupAttributes] updates group attributes. [deleteGroupAttributes], delete the group attribute.
onGroupMemberStateChanged
void onGroupMemberStateChanged(ZIM zim, ZIMGroupMemberState state, ZIMGroupMemberEvent event, ArrayList<ZIMGroupMemberInfo> userList, ZIMGroupOperatedInfo operatedInfo, String groupID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| state | ZIMGroupMemberState | Updated membership status. |
| event | ZIMGroupMemberEvent | Updated member events. |
| userList | ArrayList<ZIMGroupMemberInfo> | Updated member information. |
| operatedInfo | ZIMGroupOperatedInfo | Updated operational information. |
| groupID | String | The groupID where the member state change occurred. |
Details
Group member status change notification callback.
- Use cases: Scenarios that require interaction based on group member states.
- When to call /Trigger: Notification is triggered when a group is created, joined, left, or dismissed, or a user is invited to join or kicked out of the group.
- Related APIs: [createGroup], creates a group. [joinGroup], joins a group. [leaveGroup], leave the group. [dismissGroup], dismiss the group. [intiveUsersIntoGroup], which invites users to join the group. [kickGroupMembers], kicks the user out of the group.
onGroupMemberInfoUpdated
void onGroupMemberInfoUpdated(ZIM zim, ArrayList<ZIMGroupMemberInfo> groupMemberInfos, ZIMGroupOperatedInfo operatedInfo, String groupID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| groupMemberInfos | ArrayList<ZIMGroupMemberInfo> | Updated member information. |
| operatedInfo | ZIMGroupOperatedInfo | Updated operational information. |
| groupID | String | The groupID where the group member information has been changed. |
Details
Return the operation result of changing group member information.
- Use cases: After the basic information of group members is changed, you need to display or interact with group members on the page.
- When to call /Trigger: The result is displayed after the group member information is changed.
- Related APIs: [setGroupMemberNickname], updates the nickname of a group member. [setGroupMemberRole], updates the group member role. [transferGroupOwner], group master transfer.
onGroupApplicationListChanged
void onGroupApplicationListChanged(ZIM zim, ArrayList<ZIMGroupApplicationInfo> applicationList, ZIMGroupApplicationListChangeAction action)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| applicationList | ArrayList<ZIMGroupApplicationInfo> | The data of the group application list changes. |
| action | ZIMGroupApplicationListChangeAction | When receiving changes to the group application list, this value can be used to determine whether it's a deletion action or an addition action." |
- When to call: After creating a ZIM instance through [create].
- Related APIs: [sendGroupJoinApplication], [sendGroupInviteApplications].
onGroupApplicationUpdated
void onGroupApplicationUpdated(ZIM zim, ArrayList<ZIMGroupApplicationInfo> applicationList)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| applicationList | ArrayList<ZIMGroupApplicationInfo> | The data of the group application list changes. |
- When to call: After creating a ZIM instance through [create].
- Related APIs: [acceptGroupJoinApplication], [rejectGroupJoinApplication], [acceptGroupInviteApplication], [rejectGroupInviteApplication].
onConversationChanged
void onConversationChanged(ZIM zim, ArrayList<ZIMConversationChangeInfo> conversationChangeInfoList)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| conversationChangeInfoList | ArrayList<ZIMConversationChangeInfo> | Changed information about the conversation. |
Details
Trigger this callback to return notification of session updates when a session is added, deleted, modified, pinned or unpinned.
- When to call /Trigger: Notifications are triggered when a new message is updated in the session, or when the session itself is added, deleted, or modified.
- Caution: ConversationID is the same as single chat toUserID and group chat GroupID.
- Related APIs: Triggered by [sendPeerMessage], [sendGroupMessage], [sendRoomMessage], [deleteConversation], [deleteMessage], [deleteMessageByConversationID], [updateConversationPinnedState].
- Available since: 2.0.0 and above.
onConversationMessageReceiptChanged
void onConversationMessageReceiptChanged(ZIM zim, ArrayList<ZIMMessageReceiptInfo> infos)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| infos | ArrayList<ZIMMessageReceiptInfo> | Receipt information. |
Details
When the message receiver has read the session, the message sender knows through this callback.
- Trigger: Trigger a notification when the message receiver has read the session.
- Related APIs: triggered when the peer calls via [sendConversationMessageReceiptRead].
- Available since: 2.5.0 and above.
onConversationSyncStateChanged
void onConversationSyncStateChanged(ZIM zim, ZIMConversationSyncState state)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| state | ZIMConversationSyncState | The synchronizing conversation list state from server. |
Details
This callback is triggered to notify of conversation updates when the SDK initiates the process of synchronizing conversations from the server after initial login, and when the process completes or fails.
When to
- Trigger: The notification is triggered when the SDK confirms the need to pull list data from the server.
- Caution: ConversationID is the same as single chat toUserID and group chat GroupID.
- Available since: 2.21.0 and above.
onConversationsAllDeleted
callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| info | ZIMConversationsAllDeletedInfo | Info about all conversations be deleted. |
Details
When multiple login ends delete all conversations, the local end triggers the callback to notify the local end that all conversations are deleted.
- When to call /Trigger: When another end clears all unread conversations, the local end triggers a notification.
- Related APIs: Triggered by [deleteAllConversations] .
- Available since: 2.12.0 and above.
onMessageReceiptChanged
void onMessageReceiptChanged(ZIM zim, ArrayList<ZIMMessageReceiptInfo> infos)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| infos | ArrayList<ZIMMessageReceiptInfo> | Receipt information. |
Details
When the message receiver confirms that the message has been read, the message sender knows through this callback.
- Trigger: Trigger a notification when the message receiver has read the message.
- Related APIs: triggered when the peer calls via [sendMessageReceiptsRead].
- Available since: 2.5.0 and above.
onConversationTotalUnreadMessageCountUpdated
void onConversationTotalUnreadMessageCountUpdated(ZIM zim, int totalUnreadMessageCount)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| totalUnreadMessageCount | int | Updated total unreads. |
Details
This callback is used to return the total unread of the session.
- When to call /Trigger: Log in, call [deleteConversation], [deleteMessage], [deleteAllMessageByConversationID], [clearConversationUnreadMessageCount], [clearConversationTotalUnreadMessageCount] Causes the message reading to change to trigger the callback.
- Related APIs: [deleteConversation]、[deleteMessage]、[deleteMessageByConversationID]、[clearConversationUnreadMessageCount]、[clearConversationTotalUnreadMessageCount]
- Available since: 2.0.0 and above.
onGroupMessageReceived
void onGroupMessageReceived(ZIM zim, ArrayList<ZIMMessage> messageList, ZIMMessageReceivedInfo info, String fromGroupID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| messageList | ArrayList<ZIMMessage> | List of received messages. |
| info | ZIMMessageReceivedInfo | Message Receiving information about the event. |
| fromGroupID | String | ID of the group that received the message. |
Details
When the user is online, they can receive online group messages through this callback. Also, when the user logs back into the ZIM SDK, they can receive all the group chat messages received during the offline period (up to 7 days) through this callback.
Call timing: This callback occurs when a ZIM instance is created with [create] and a group member sends a message.
- Related callbacks: You can send messages to other group members via [sendGroupMessage].
- Available since: 2.18.0 or above
onPeerMessageReceived
void onPeerMessageReceived(ZIM zim, ArrayList<ZIMMessage> messageList, ZIMMessageReceivedInfo info, String fromUserID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| messageList | ArrayList<ZIMMessage> | List of received messages. |
| info | ZIMMessageReceivedInfo | Receive information about the message event. |
| fromUserID | String | The unique identifier of the message sender. |
Details
When the user is online, they can receive one-on-one chat messages through this callback. Also, when the user logs back into the ZIM SDK, they can receive all the one-on-one chat messages received during the offline period (up to 7 days) through this callback.
Call timing: This callback occurs when a ZIM instance is created with [create] and the other user sends you a message.
- Related callbacks: You can send messages to other members via [sendPeerMessage].
- Available since: 2.18.0 or above
onRoomMessageReceived
void onRoomMessageReceived(ZIM zim, ArrayList<ZIMMessage> messageList, ZIMMessageReceivedInfo info, String fromRoomID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| messageList | ArrayList<ZIMMessage> | List of received messages. |
| info | ZIMMessageReceivedInfo | Message receiving the information carried by the event. |
| fromRoomID | String | ID of the room chat that received the message. |
Details
When the user is online, they can receive online room messages through this callback. Also, when the user transitions back to online status from being offline, if they are still in the room, they can receive all the room messages received during the offline period through this callback.
Call timing: This callback occurs when a ZIM instance is created with [create] and a group member sends a message.
- Related callbacks: You can send messages to other group members via [sendRoomMessage].
- Available since: 2.18.0 or above
onMessageEdited
void onMessageEdited(ZIM zim, ArrayList<ZIMMessage> messageList)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| messageList | ArrayList<ZIMMessage> | List of received messages. |
Details
This callback is received when some one edited a message.
Call timing: This callback occurs when a ZIM instance is created with [create] and the other user edited a message.
- Related callbacks: You can edit the message sent successfully by yourself through [editMessage].
- Available since: 2.20.0 or above.
onMessagePinStatusChanged
void onMessagePinStatusChanged(ZIM zim, ArrayList<ZIMMessagePinStatusChangeInfo> changeInfoList)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| changeInfoList | ArrayList<ZIMMessagePinStatusChangeInfo> | List of received messages pinned status changed info list. |
Details
This notification is received when a message successfully is pinned or unpinned.
Call timing: This callback occurs after a ZIM instance is created with [create] and another user successfully pins or unpins a message.
- Related APIs: You can pin or unpin a message you successfully sent yourself through [pinMessage].
onMessageRevokeReceived
void onMessageRevokeReceived(ZIM zim, ArrayList<ZIMMessage> messageList)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| messageList | ArrayList<ZIMMessage> | List of received messages. |
Details
This callback is received when some one else sends a message and then revoke.
Call timing: This callback occurs when a ZIM instance is created with [create] and the other user revoke a message.
- Related callbacks: You can revoke message to other members via [revokeMessage].
- Available since: 2.5.0 or above.
onMessageSentStatusChanged
void onMessageSentStatusChanged(ZIM zim, ArrayList<ZIMMessageSentStatusChangeInfo> infos)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| infos | ArrayList<ZIMMessageSentStatusChangeInfo> | List of received messages. |
Details
This callback is received when messages status changed.
Call timing: This callback occurs when messages status changed.
- Related callbacks: You can send message to other members via [sendMessage].
- Available since: 2.6.0 or above.
onBroadcastMessageReceived
void onBroadcastMessageReceived(ZIM zim, ZIMMessage message)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| message | ZIMMessage | Received message. |
Details
The callback is received when the server interface [SendMessageToAllUsers] sends a message.
Call time: This callback is received after logging in to the ZIM service and the server call the [SendMessageToAllUsers] interface to send a message.
onMessageReactionsChanged
void onMessageReactionsChanged(ZIM zim, ArrayList<ZIMMessageReaction> reactions)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| reactions | ArrayList<ZIMMessageReaction> | The list of changed reactions. |
Details
The callback is received when reactions change
When to Call: This callback can be registered after the ZIM instance is created by [create] and before login.
When to
- Trigger: After other users add or delete reactions to messages in private or group chats.
- Related APIs: [addMessageReaction]、[deleteMessageReaction]
onMessageDeleted
void onMessageDeletedcallback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| deletedInfo | ZIMMessageDeletedInfo | Deleted message information. |
Details
In the multi-terminal login scenario, after the user deletes the server level message on device A, other online multi-terminal devices will receive this callback..
onReceivePeerMessage
void onReceivePeerMessage(ZIM zim, ArrayList<ZIMMessage> messageList, String fromUserID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| messageList | ArrayList<ZIMMessage> | List of received messages. |
| fromUserID | String | The user ID of the message sender.The same as the peer-chat conversation ID. |
Details
This callback is received when you receive a point-to-point message from someone else.
Call timing: This callback occurs when a ZIM instance is created with [create] and the other user sends you a message.
- Related callbacks: You can send messages to other members via [sendPeerMessage].
- Available since: 2.0.0 or above
onReceiveRoomMessage
void onReceiveRoomMessage(ZIM zim, ArrayList<ZIMMessage> messageList, String fromRoomID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| messageList | ArrayList<ZIMMessage> | List of received messages. |
| fromRoomID | String | ID of the room where the message was received. |
Details
This callback is received when an in-room message is received.
Call timing: This callback occurs when a ZIM instance is created with [create] and a group member sends a message.
- Related callbacks: You can send messages to other group members via [sendRoomMessage].
- Available since: 2.0.0 or above
onMessageRepliedCountChanged
void onMessageRepliedCountChanged(ZIM zim, ArrayList< ZIMMessageRootRepliedCountInfo> infos)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| infos | ArrayList< ZIMMessageRootRepliedCountInfo> | A list of the number of replies to the root message. |
Details
When there is a new reply message, the number of replies to the corresponding root message is notified through this event.
- Available since: 2.17.0 or above
onMessageRepliedInfoChanged
void onMessageRepliedInfoChanged(ZIM zim, ArrayList<ZIMMessage> messageList)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| messageList | ArrayList<ZIMMessage> | List of received messages. |
Details
Change event for a reply message received after the source message referenced by the reply message is deleted and withdrawn.
- Available since: 2.17.0 or above
onReceiveGroupMessage
void onReceiveGroupMessage(ZIM zim, ArrayList<ZIMMessage> messageList, String fromGroupID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| messageList | ArrayList<ZIMMessage> | List of received messages. |
| fromGroupID | String | The group ID of the message sender. |
Details
This callback is received when a group message is received.
Call timing: This callback occurs when a ZIM instance is created with [create] and a group member sends a message.
- Related callbacks: You can send messages to other group members via [sendGroupMessage].
- Available since: 2.0.0 or above
onRoomStateChanged
void onRoomStateChanged(ZIM zim, ZIMRoomState state, ZIMRoomEvent event, String extendedData, String roomID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| state | ZIMRoomState | The current room connection state after changed. |
| event | ZIMRoomEvent | The event that caused the room connection state to change. |
| extendedData | String | Extra information when the event occurs, a standard JSON string. |
| roomID | String | ID of the room where the status changed |
Details
event callback when the room connection status changes.
- When to call: creating a ZIM instance through [create], you can call this interface.
- Related APIs: through [onTokenWillExpire], the callback will be received when the token is about to expire.
- Available since: 1.1.0 or above.
onRoomMemberJoined
void onRoomMemberJoined(ZIM zim, ArrayList<ZIMUserInfo> memberList, String roomID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| memberList | ArrayList<ZIMUserInfo> | List of members who joined the room. |
| roomID | String | The ID of the room where this event occurred. |
Details
After joining a room, when other members also join this room, they will receive this callback.
- Use cases: When other members in the room join, this callback will be called.
- When to call: After creating a ZIM instance through [create], and the user is in a room joined by other members, you can call this interface.
- Caution: If the user is not currently in this room, this callback will not be called.
- Related APIs: You can use [onRoomMemberLeft] to receive this callback when other room members leave.
- Available since: 1.1.0 or above.
onRoomMemberLeft
void onRoomMemberLeft(ZIM zim, ArrayList<ZIMUserInfo> memberList, String roomID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| memberList | ArrayList<ZIMUserInfo> | List of members who left the room. |
| roomID | String | The ID of the room where this event occurred. |
Details
After joining a room, when other members leave the room, they will receive this callback.
- Use cases: When other members in the room leave the room, this callback will be called.
- When to call: After creating a ZIM instance through [create], and the user is in the same room of other members, you can call this interface.
- Caution: If the user is not currently in this room, this callback will not be called.
- Related APIs: You can receive this callback when other room members join through [onRoomMemberJoined].
- Available since: 1.1.0 or above.
onRoomAttributesUpdated
void onRoomAttributesUpdated(ZIM zim, ZIMRoomAttributesUpdateInfo info, String roomID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | |
| info | ZIMRoomAttributesUpdateInfo | |
| roomID | String |
Details
When the room attribute in the room changes, it will be notified through this callback.
- Available since: 1.3.0.
onRoomAttributesBatchUpdated
void onRoomAttributesBatchUpdated(ZIM zim, String roomID, ArrayList<ZIMRoomAttributesUpdateInfo> infos)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | |
| roomID | String | |
| infos | ArrayList<ZIMRoomAttributesUpdateInfo> |
Details
When the room attribute in the room changes, it will be notified through this callback.
- Available since: 1.3.0.
onRoomMemberAttributesUpdated
void onRoomMemberAttributesUpdated(ZIM zim, ArrayList<ZIMRoomMemberAttributesUpdateInfo> infos, ZIMRoomOperatedInfo operatedInfo, String roomID)callback/ZIMEventHandler.javaParameters
| Name | Type | Description |
|---|---|---|
| zim | ZIM | ZIM instance. |
| infos | ArrayList<ZIMRoomMemberAttributesUpdateInfo> | The infos of the room member attributes changed. |
| operatedInfo | ZIMRoomOperatedInfo | Room operation information. |
| roomID | String | Room ID. |
Details
Details: This callback will be received when a user's property in the room is changed.
ZPNsManager
Details
ZPNs SDK main class.
Declared in ZPNsManager.java
Methods
getInstance
ZPNsManager * getInstance()ZPNsManager.javaGet the ZPNs instance.
- Use cases: This method is used to obtain ZPNs singletons when ZPNs is used.
- Available since: 2.0.0 or later.
ZPNs instance.
enableDebug
void enableDebug()ZPNsManager.javaDetailed description: whether to enable debug mode
getPushConfig
ZPNsConfig getPushConfig()ZPNsManager.javaGet the PushConfig data class object.
- Use cases: This method is called when the developer needs to get the PushConfig data class object.
- When to call /Trigger: There is no time limit to call, developers can call when they need.
- Available since: 2.0.0 or later.
PushConfig data class.
getZPNsMessage
ZPNsMessage getZPNsMessage(final Application context)ZPNsManager.javaParameters
| Name | Type | Description |
|---|---|---|
| Application context | final | Android context. |
- When to call /Trigger: Called in the onCreate or onResume method in the activity.
- Available since: 2.5.0 or later.
registerPush
void registerPush(final Application context)ZPNsManager.javaParameters
| Name | Type | Description |
|---|---|---|
| Application context | final | Android context. |
Details
This method is used to register vendor offline push.
- Use cases: This method is called when a developer needs to use offline push.
- Available since: ZPNs 2.0.0 or later.
setApplicationIconBadgeNumber
void setApplicationIconBadgeNumber(Context context, int badgeNumber)ZPNsManager.javaParameters
| Name | Type | Description |
|---|---|---|
| context | Context | nterface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc. |
| badgeNumber | int | Number of app local corner markers to be set. |
Details
Set the number of app local corner markers.Supports Huawei, VIVO, and OPPO apis.
- Use cases: Called when the developer needs to modify the number of local corner markers.
- Default value: None.
- Available since: ZPNs version 2.6.0 or later.
setPushConfig
void setPushConfig(ZPNsConfig config)ZPNsManager.javaParameters
| Name | Type | Description |
|---|---|---|
| config | ZPNsConfig | ZPNs configuration data class. |
Details
Set push Settings for each vendor.
- Use cases: Developers need to use this method to set up configurations pushed by vendors.
- Default value: Called when vendor push needs to be set.
- Available since: 2.0.0 or later.
unregisterPush
void unregisterPush()ZPNsManager.javaCall this method to de-register when offline push is not required.
- Use cases: This method can be called to de-register when a user clicks a close message notification within the application.
- When to call /Trigger: Called when de-registration is required.
- Caution: It needs to be called after [registerPush] is called.
- Available since: 2.0.0 or later.
ZPNsMessageReceiver
Details
callback.
Declared in ZPNsMessageReceiver.java
Methods
onNotificationArrived
void onNotificationArrived(Context context, ZPNsMessage message)ZPNsMessageReceiver.javaParameters
| Name | Type | Description |
|---|---|---|
| context | Context | context. |
| message | ZPNsMessage | the ZPNs message data class. |
Details
Vendor notification display callback.
- When to call /Trigger: Vendor notification displays are uniformly thrown on this interface when a callback is triggered.
- Available since: 2.0.0 or later.
onNotificationClicked
void onNotificationClicked(Context context, ZPNsMessage message)ZPNsMessageReceiver.javaParameters
| Name | Type | Description |
|---|---|---|
| context | Context | context. |
| message | ZPNsMessage | ZPNs message object. |
Details
Vendor notification click callback.
- When to call /Trigger: Each vendor's notification click callback is uniformly thrown in this interface.
- Available since: 2.0.0 or later.
onRegistered
void onRegistered(String Pushid, ZPNsRegisterMessage message)ZPNsMessageReceiver.javaParameters
| Name | Type | Description |
|---|---|---|
| Pushid | String | ZPNs generated pushID for offline push. |
| message | ZPNsRegisterMessage | Offline push message object. |
Details
This callback can be implemented to return the PushID generated by ZPNs after the [setDeviceToken] call.
- Use cases: Developers can implement this callback if they need to get PushID after they connect to the SDK.
- When to call /Trigger: This notification is triggered after a call to [setDeviceToken].
- Available since: 2.0.0 or later.
onThroughMessageReceived
void onThroughMessageReceived(Context context, ZPNsMessage message)ZPNsMessageReceiver.javaParameters
| Name | Type | Description |
|---|---|---|
| context | Context | Context. |
| message | ZPNsMessage | ZPNs message class. |
Details
Vendor transparent message callback.
- Use cases: Pass-through messages returned by each vendor trigger this interface and throw notifications on it.
- When to call /Trigger: There is a passthrough message trigger when push arrives.
- Available since: 2.0.0 or later.
