hyphenate_SDK4.0 4.8.0
hyphenate java IM SDK
|
The settings of the chat SDK.
You can set parameters and options of the SDK.
For example, whether to encrypt the messages before sending, whether to automatically accept the friend invitations.
void com.hyphenate.chat.EMOptions.allowChatroomOwnerLeave | ( | boolean | allowed | ) |
Sets whether to allow the chat room owner to leave the chat room.
allowed | Whether to allow the chat room owner to leave the chat room.
|
boolean com.hyphenate.chat.EMOptions.autoAcceptGroupInvitations | ( | ) |
Gets whether to accept group invitations automatically.
true
: Accept group invitations automatically.false
: Do not accept group invitations automatically. boolean com.hyphenate.chat.EMOptions.canChatroomOwnerLeave | ( | ) |
Gets whether to allow owner of chat room to leave.
true
: Yes.false
: No. The chat room owner cannot leave the chat room. boolean com.hyphenate.chat.EMOptions.deleteMessagesOnLeaveChatroom | ( | ) |
Gets whether to delete the chat room message when leaving the chat room.
true
: Delete the chat room related message record when leaving the chat room.false
: Do not delete the chat room related message record when leaving the chat room. boolean com.hyphenate.chat.EMOptions.deleteMessagesOnLeaveGroup | ( | ) |
Gets whether to delete the group message when leaving a group.
true
: Delete the messages when leaving a group.false
: Do not delete the messages when leaving a group. void com.hyphenate.chat.EMOptions.enableDNSConfig | ( | boolean | enable | ) |
Sets whether to disable DNS.
enable | Whether to disable DNS:
|
boolean com.hyphenate.chat.EMOptions.getAcceptInvitationAlways | ( | ) |
Gets whether to accept other user's friend invitations automatically.
true
: Accepting friend invitation automatically.false
: Do not accepting friend invitation automatically. String com.hyphenate.chat.EMOptions.getAccessToken | ( | ) |
Gets the access token from the local database.
String com.hyphenate.chat.EMOptions.getAccessToken | ( | boolean | b | ) |
Whether to get the access token from the server.
b | Whether to get the access token from server.
|
String com.hyphenate.chat.EMOptions.getAppKey | ( | ) |
Gets the app key.
int com.hyphenate.chat.EMOptions.getAreaCode | ( | ) |
Gets the area code.
This parameter is used to restrict the scope of accessible edge nodes.
boolean com.hyphenate.chat.EMOptions.getAutodownloadThumbnail | ( | ) |
Gets whether to download the thumbnail automatically.
true
: Download the thumbnail automatically;false
: Do not download the thumbnail automatically. boolean com.hyphenate.chat.EMOptions.getAutoLogin | ( | ) |
Checks whether the automatic login is enabled.
true
: Automatic login is enabled;false
: Automatic login is disabled. boolean com.hyphenate.chat.EMOptions.getAutoTransferMessageAttachments | ( | ) |
Gets whether to upload the message attachments automatically to the chat server.
true
: Yes.false
: No. A custom path is used to for uploading. String com.hyphenate.chat.EMOptions.getCustomDeviceName | ( | ) |
Gets the custom name of the current device.
int com.hyphenate.chat.EMOptions.getCustomOSPlatform | ( | ) |
Gets the custom platform code of a login device.
String com.hyphenate.chat.EMOptions.getDnsUrl | ( | ) |
Gets the DNS url.
boolean com.hyphenate.chat.EMOptions.getEnableDNSConfig | ( | ) |
Gets whether to disable DNS.
true
: Disable DNS;false
: Do not disable DNS.int com.hyphenate.chat.EMOptions.getFixedInterval | ( | ) |
Gets the fixed heartbeat interval.
int com.hyphenate.chat.EMOptions.getImPort | ( | ) |
Gets the custom IM server port.
String com.hyphenate.chat.EMOptions.getImServer | ( | ) |
Gets the custom IM message server URL.
String com.hyphenate.chat.EMOptions.getLoginCustomExt | ( | ) |
Gets the custom device extension information.
String com.hyphenate.chat.EMOptions.getNativeLibBasePath | ( | ) |
Gets the path of native library.
EMPushConfig com.hyphenate.chat.EMOptions.getPushConfig | ( | ) |
Gets the push configurations.
String com.hyphenate.chat.EMOptions.getReportServer | ( | ) |
Gets the URL of the custom server for data reporting.
boolean com.hyphenate.chat.EMOptions.getRequireAck | ( | ) |
Gets whether the read receipt is required by the message receiver.
true
: The read receipt is required;false
: The read receipt is not required. boolean com.hyphenate.chat.EMOptions.getRequireDeliveryAck | ( | ) |
Gets whether the delivery receipt is required.
true
: The read receipt is required;false
: The read receipt is not required. String com.hyphenate.chat.EMOptions.getRestServer | ( | ) |
Gets the custom REST server URL.
boolean com.hyphenate.chat.EMOptions.getUsingHttpsOnly | ( | ) |
Gets whether only HTTPS is used for REST operations.
true
: Only HTTPS is used;false
: Both HTTP and HTTPS can be used. String com.hyphenate.chat.EMOptions.getVersion | ( | ) |
Gets the SDK version.
boolean com.hyphenate.chat.EMOptions.isAutoAcceptGroupInvitation | ( | ) |
Gets whether to accept a group invitation automatically.
true
: Accept group invitations automatically;false
: Do not accept group invitations automatically.boolean com.hyphenate.chat.EMOptions.isAutoLoadAllConversations | ( | ) |
Gets whether to automatically load all conversations into the memory upon a successful login.
true
: Automatically load all conversations.false
: Do not automatically load all conversations. boolean com.hyphenate.chat.EMOptions.isChatroomOwnerLeaveAllowed | ( | ) |
Gets whether to allow the owner of chat room to leave.
true
: Yes. Even if the chat room owner leaves the chat room, the owner still has all privileges, except for receiving messages in the chat room.false
: When the owner leave do keep the conversation. boolean com.hyphenate.chat.EMOptions.isDeleteMessagesAsExitChatRoom | ( | ) |
Gets whether to delete the chat room message when leaving the chat room.
true
: Delete the chat room related message record when leaving the chat room.false
: Do not delete the chat room related message record when leaving the chat room.boolean com.hyphenate.chat.EMOptions.isDeleteMessagesAsExitGroup | ( | ) |
Gets whether to delete the group message when leaving a group.
true
: Delete the messages when leaving a group.false
: Do not delete the messages when leaving a group.boolean com.hyphenate.chat.EMOptions.isEnableStatistics | ( | ) |
Checks whether the traffic statistics collection is enabled for local messages.
true
: Enabled;false
: Disabled. boolean com.hyphenate.chat.EMOptions.isEnableTLSConnection | ( | ) |
Gets whether the TLS connection is enabled.
true
: The TLS connection is enabled.false
: The TLS connection is disabled. boolean com.hyphenate.chat.EMOptions.isIncludeSendMessageInMessageListener | ( | ) |
Whether the sent message is included in EMMessageListener#onMessageReceived(java.util.List).
true
: Yes. Besides the received message, the sent message is also included in EMMessageListener#onMessageReceived(java.util.List).false
: No. Only the received message is included in EMMessageListener#onMessageReceived(java.util.List). boolean com.hyphenate.chat.EMOptions.isLoadEmptyConversations | ( | ) |
Checks whether to include empty conversations when the SDK loads conversations from the local database.
false
: Empty conversations are excluded.true
: Empty conversations are included. boolean com.hyphenate.chat.EMOptions.isSortMessageByServerTime | ( | ) |
Gets whether to sort messages by the time when the server received them.
true
: Yes. Messages are sorted by the time when the server received them;false
: No. Messages are not sorted by the time when the server received them. boolean com.hyphenate.chat.EMOptions.isUseReplacedMessageContents | ( | ) |
Gets whether the server returns the sender the text message with the content replaced during text moderation.
true
: Yes.false
: No. The server returns the original message to the sender. boolean com.hyphenate.chat.EMOptions.regardImportedMsgAsRead | ( | ) |
\~chinese 是否将通过服务器导入的消息设置为已读: @return 是否将通过服务器导入的消息设置为已读: - `true`:将导入消息置为已读。 - (默认)`false`:不将导入消息置为已读; \~english Whether to set messages from the server side as read. @return Whether to set messages from the server side as read: - `true`: Read. After the messages are imported, the number of unread messages obtained with `EMConversation#getUnreadMsgCount() remains unchanged.
remains unchanged.
: Unread. After the messages are imported, the number of unread messages obtained with
EMConversation::getUnreadMsgCount() is increased. void com.hyphenate.chat.EMOptions.setAcceptInvitationAlways | ( | boolean | value | ) |
Sets whether to accept the friend invitation automatically.
value | Whether to accept the friend invitation automatically.
|
void com.hyphenate.chat.EMOptions.setAppKey | ( | String | appkey | ) |
Sets the app key.
appkey | The app key you got from the console when creating an app. |
void com.hyphenate.chat.EMOptions.setAreaCode | ( | int | code | ) |
Sets the area code.
code | The area code. This parameter is used to restrict the scope of accessible edge nodes. The default value is AREA_CODE_GLOB , indicating that no restriction is placed on the scope of accessible edge nodes. The parameter setting cannot be changed during the app runtime. |
void com.hyphenate.chat.EMOptions.setAutoAcceptGroupInvitation | ( | boolean | value | ) |
Sets whether to accept a group invitation automatically.
value | Whether to accept group invitation automatically.
|
void com.hyphenate.chat.EMOptions.setAutoDownloadThumbnail | ( | boolean | autodownload | ) |
Sets whether to auto download the thumbnail.
autodownload | Whether to download the thumbnail automatically.
|
void com.hyphenate.chat.EMOptions.setAutoLoadAllConversations | ( | boolean | autoLoadAllConversations | ) |
Sets whether to automatically load all conversations into the memory upon a successful login.
As for the call sequence, this method comes before EMClient#init(Context, EMOptions).
autoLoadAllConversations | Whether to automatically load all conversations.
|
void com.hyphenate.chat.EMOptions.setAutoLogin | ( | boolean | autoLogin | ) |
Enables/Disables automatic login.
autoLogin |
|
void com.hyphenate.chat.EMOptions.setAutoTransferMessageAttachments | ( | boolean | transfer | ) |
Sets whether to upload the message attachments automatically to the chat server.
transfer | Whether to automatically upload the message attachments to the chat server.
|
void com.hyphenate.chat.EMOptions.setCustomDeviceName | ( | @NonNull String | customDeviceName | ) |
Sets a custom name for the current device.
Setting a custom name for the current device is intended to differentiate devices during multi-device login scenarios.
You can call EMClient#getLoggedInDevicesFromServer(String, String) to get the information of login devices of a specified account.
You can set the custom name for the current device before calling EMClient#init(Context, EMOptions).
customDeviceName | The custom name for the current device. The parameter value cannot be null or an empty string. The default value is the device model such as HUAWEICOL-AL10. |
void com.hyphenate.chat.EMOptions.setCustomOSPlatform | ( | int | platform | ) |
Sets a custom platform code for the login device.
You need to set the custom platform code before calling EMClient#init(Context, EMOptions).
platform | The custom platform code. The value range is 1-100. |
void com.hyphenate.chat.EMOptions.setDeleteMessagesAsExitChatRoom | ( | boolean | delete | ) |
Sets whether to delete the chat room message when leaving the chat room.
delete | -(Default)true : Delete the chat room related message record when leaving the chat room.
|
void com.hyphenate.chat.EMOptions.setDeleteMessagesAsExitGroup | ( | boolean | delete | ) |
Sets whether to delete the group messages when leaving the group.
delete |
|
void com.hyphenate.chat.EMOptions.setDnsUrl | ( | String | dnsUrl | ) |
Sets the DNS url.
dnsUrl | The DNS url. |
void com.hyphenate.chat.EMOptions.setEnableStatistics | ( | boolean | enableStatistics | ) |
Sets whether to enable traffic statistics collection for local messages.
You need to enable traffic statistics collection before calling EMClient#init(Context, EMOptions).
enableStatistics | Whether to enable the message traffic statistics collection:
|
void com.hyphenate.chat.EMOptions.setEnableTLSConnection | ( | boolean | enableTLSConnection | ) |
Sets whether to enable the TLS connection.
This setting is used only in private deployment.
As for the call sequence, this method comes before EMClient#init(Context, EMOptions).
enableTLSConnection | Whether to enable the TLS connection.
|
void com.hyphenate.chat.EMOptions.setFixedHBInterval | ( | int | interval | ) |
Sets a fixed heartbeat interval.
If not set, the optimal heartbeat interval is automatically detected.
interval | The interval of heartbeat in seconds. The recommended value range is 30-300. |
void com.hyphenate.chat.EMOptions.setImPort | ( | int | imPort | ) |
Sets the custom IM server port.
imPort | The custom IM server port. |
void com.hyphenate.chat.EMOptions.setIMServer | ( | String | imServer | ) |
Sets the custom IM message server URL.
imServer | The custom IM message server URL. |
void com.hyphenate.chat.EMOptions.setIncludeSendMessageInMessageListener | ( | boolean | include | ) |
Sets whether the sent message is included in EMMessageListener#onMessageReceived(java.util.List).
include | Whether the sent message is included in EMMessageListener#onMessageReceived(java.util.List).
|
void com.hyphenate.chat.EMOptions.setLoadEmptyConversations | ( | boolean | isLoadEmptyConversations | ) |
Sets whether to include empty conversations when the SDK loads conversations from the local database.
As for the call sequence, this method comes before EMClient#init(Context, EMOptions).
isLoadEmptyConversations | Whether to include empty conversations when the SDK loads conversations from the local database:
|
void com.hyphenate.chat.EMOptions.setLoginCustomExt | ( | @NonNull String | ext | ) |
Sets custom extension information for the current device.
If the SDK is not initialized or automatic login is used, you need to set the extension information of the current device before you call the method. If the SDK is initialized and manual login is used, you can set the extension information before your next call to the EMClient#login(String,String,EMCallBack) or EMClient#loginWithToken(String,String,EMCallBack) method.
ext | The custom extension information for the current device. The extension information can contain up to 1024 characters and cannot be null . |
The extension information is contained in the notification sent to the device that is kicked offline due to the user's login to the current device.
void com.hyphenate.chat.EMOptions.setNativeLibBasePath | ( | @NonNull String | path | ) |
Sets the path of the native library.
path | The path of the native library.
|
void com.hyphenate.chat.EMOptions.setPushConfig | ( | EMPushConfig | pushConfig | ) |
Sets the push options.
pushConfig | The push configuration. |
void com.hyphenate.chat.EMOptions.setRegardImportedMsgAsRead | ( | boolean | regardImportedMsgAsRead | ) |
Sets whether to set messages from the server side as read.
regardImportedMsgAsRead | Whether to set messages from the server side as read:
|
void com.hyphenate.chat.EMOptions.setReportServer | ( | String | reportServer | ) |
Sets the URL of the custom server for data reporting.
reportServer | The URL of the custom server for data reporting. |
void com.hyphenate.chat.EMOptions.setRequireAck | ( | boolean | requireAck | ) |
Sets whether to require the read receipt.
requireAck | Whether the read receipt is required.
|
void com.hyphenate.chat.EMOptions.setRequireDeliveryAck | ( | boolean | requireDeliveryAck | ) |
Sets whether the delivery receipt is required.
requireDeliveryAck | Whether the delivery receipt is required.
|
void com.hyphenate.chat.EMOptions.setRestServer | ( | String | restServer | ) |
Sets the custom REST server URL.
restServer | The custom REST server URL. |
void com.hyphenate.chat.EMOptions.setSortMessageByServerTime | ( | boolean | sortByServerTime | ) |
Sets whether to sort messages by the time when the server received them.
sortByServerTime |
|
void com.hyphenate.chat.EMOptions.setUseReplacedMessageContents | ( | boolean | useReplacedMessageContents | ) |
Sets whether the server returns the sender the text message with the content replaced during text moderation:
As for the call sequence, this method comes before EMClient#init(Context, EMOptions).
useReplacedMessageContents | Whether to return the adjusted message to the sender:
|
void com.hyphenate.chat.EMOptions.setUsingHttpsOnly | ( | boolean | _usingHttpsOnly | ) |
Sets whether only HTTPS is used for REST operation.
_usingHttpsOnly | Whether only HTTPS is used.
|