hyphenate_SDK4.0 5.0.0
hyphenate java IM SDK
 
Loading...
Searching...
No Matches
com.hyphenate.chat.EMOptions Class Reference

Classes

enum  AreaCode
 
enum  EMDataSyncType
 

Public Member Functions

boolean getRequireDeliveryAck ()
 
void setRequireDeliveryAck (boolean requireDeliveryAck)
 
boolean getAcceptInvitationAlways ()
 
void setAcceptInvitationAlways (boolean value)
 
void setDeleteMessagesAsExitGroup (boolean delete)
 
boolean deleteMessagesOnLeaveGroup ()
 
void setAutoAcceptGroupInvitation (boolean value)
 
boolean autoAcceptGroupInvitations ()
 
void allowChatroomOwnerLeave (boolean allowed)
 
boolean canChatroomOwnerLeave ()
 
void setDeleteMessagesAsExitChatRoom (boolean delete)
 
boolean deleteMessagesOnLeaveChatroom ()
 
boolean isSortMessageByServerTime ()
 
void setSortMessageByServerTime (boolean sortByServerTime)
 
void setAppKey (String appkey)
 
String getAppKey ()
 
void setAppId (String appId)
 
String getAppId ()
 
void setIMServer (String imServer)
 
String getImServer ()
 
void setImPort (int imPort)
 
int getImPort ()
 
void setWebSocketServer (String wsServer)
 
String getWebSocketServer ()
 
void setWebSocketPort (int wsPort)
 
int getWebSocketPort ()
 
void setSyncDataWebSocketServer (String host)
 
String getSyncDataWebSocketServer ()
 
void setSyncDataWebSocketPort (int port)
 
int getSyncDataWebSocketPort ()
 
void setRestServer (String restServer)
 
String getRestServer ()
 
void enableDNSConfig (boolean enable)
 
boolean getEnableDNSConfig ()
 
void setUsingHttpsOnly (boolean _usingHttpsOnly)
 
boolean getUsingHttpsOnly ()
 
void setAutoTransferMessageAttachments (boolean transfer)
 
boolean getAutoTransferMessageAttachments ()
 
void setAutoDownloadThumbnail (boolean autodownload)
 
boolean getAutodownloadThumbnail ()
 
void setFixedHBInterval (int interval)
 
int getFixedInterval ()
 
String getVersion ()
 
String getAccessToken ()
 
String getAccessToken (boolean b)
 
void setDnsUrl (String dnsUrl)
 
String getDnsUrl ()
 
EMPushConfig getPushConfig ()
 
void setPushConfig (EMPushConfig pushConfig)
 
boolean isEnableStatistics ()
 
void setEnableStatistics (boolean enableStatistics)
 
void setAreaCode (AreaCode code)
 
int getAreaCode ()
 
int getCustomOSPlatform ()
 
void setCustomOSPlatform (int platform)
 
String getCustomDeviceName ()
 
void setCustomDeviceName (@NonNull String customDeviceName)
 
void setLoginCustomExt (@NonNull String ext)
 
String getLoginCustomExt ()
 
boolean isLoadEmptyConversations ()
 
void setLoadEmptyConversations (boolean isLoadEmptyConversations)
 
boolean isUseReplacedMessageContents ()
 
void setUseReplacedMessageContents (boolean useReplacedMessageContents)
 
boolean isIncludeSendMessageInMessageListener ()
 
void setIncludeSendMessageInMessageListener (boolean include)
 
boolean regardImportedMsgAsRead ()
 
void setRegardImportedMsgAsRead (boolean regardImportedMsgAsRead)
 
void setNativeLibBasePath (@NonNull String path)
 
String getNativeLibBasePath ()
 
void setEnableTLSConnection (boolean enableTLSConnection)
 
boolean isEnableTLSConnection ()
 
void setAutoLoadAllConversations (boolean autoLoadAllConversations)
 
boolean isAutoLoadAllConversations ()
 
String getUIKitVersion ()
 
void setUIKitVersion (String uikitVersion)
 
EMSDKPlatform getSDKPlatform ()
 
void setSDKPlatform (EMSDKPlatform platform)
 
int getDohVendor ()
 
void setNtpServers (List< String > servers)
 
List< String > getNtpServers ()
 
boolean isEnableUserInfo ()
 
void setEnableUserInfo (boolean enableUserInfo)
 
void setDataSyncType (EnumSet< EMDataSyncType > types)
 
EnumSet< EMDataSyncTypegetDataSyncType ()
 

Detailed Description

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.

Member Function Documentation

◆ allowChatroomOwnerLeave()

void com.hyphenate.chat.EMOptions.allowChatroomOwnerLeave ( boolean allowed)

Sets whether to allow the chat room owner to leave the chat room.

Parameters
allowedWhether to allow the chat room owner to leave the chat room.
  • (Default)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: No. The chat room owner cannot leave the chat room.

◆ autoAcceptGroupInvitations()

boolean com.hyphenate.chat.EMOptions.autoAcceptGroupInvitations ( )

Gets whether to accept group invitations automatically.

Returns
Returns the whether to accept group invitation automatically.
  • (Default)true: Accept group invitations automatically.
  • false: Do not accept group invitations automatically.

◆ canChatroomOwnerLeave()

boolean com.hyphenate.chat.EMOptions.canChatroomOwnerLeave ( )

Gets whether to allow owner of chat room to leave.

Returns
Whether to allow the chat room owner to leave:
  • (Default)true: Yes.
  • false: No. The chat room owner cannot leave the chat room.

◆ deleteMessagesOnLeaveChatroom()

boolean com.hyphenate.chat.EMOptions.deleteMessagesOnLeaveChatroom ( )

Gets whether to delete the chat room message when leaving the chat room.

Returns
Whether to delete the chat room message when leaving the chat room:
  • (Default)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.

◆ deleteMessagesOnLeaveGroup()

boolean com.hyphenate.chat.EMOptions.deleteMessagesOnLeaveGroup ( )

Gets whether to delete the group message when leaving a group.

Returns
- (Default)true: Delete the messages when leaving a group.
  • false: Do not delete the messages when leaving a group.

◆ enableDNSConfig()

void com.hyphenate.chat.EMOptions.enableDNSConfig ( boolean enable)

Sets whether to enable DNS.

Parameters
enableWhether to enable DNS:
  • (Default)true: enable DNS;
  • false: disable DNS.

◆ getAcceptInvitationAlways()

boolean com.hyphenate.chat.EMOptions.getAcceptInvitationAlways ( )

Gets whether to accept friend invitations automatically.

Returns
Whether to accept friend invitations automatically.
  • (Default)true: Accept friend invitations automatically.
  • false: Do not accept friend invitations automatically.

◆ getAccessToken() [1/2]

String com.hyphenate.chat.EMOptions.getAccessToken ( )

Gets the access token from the local database.

Returns
The access token.

◆ getAccessToken() [2/2]

String com.hyphenate.chat.EMOptions.getAccessToken ( boolean b)

Whether to get the access token from the server.

Parameters
bWhether to get the access token from server.
  • (Default) true: Get the access token from server.
  • false: Do not get the access token from server.
Returns
The access token.

◆ getAppId()

String com.hyphenate.chat.EMOptions.getAppId ( )

Gets the app id.

◆ getAppKey()

String com.hyphenate.chat.EMOptions.getAppKey ( )

Gets the app key.

◆ getAreaCode()

int com.hyphenate.chat.EMOptions.getAreaCode ( )

Gets the area code.

This parameter is used to restrict the scope of accessible edge nodes.

Returns
The area code.

◆ getAutodownloadThumbnail()

boolean com.hyphenate.chat.EMOptions.getAutodownloadThumbnail ( )

Gets whether to download the thumbnails automatically.

Returns
Whether to download thumbnails automatically.
  • (Default)true: Yes;
  • false: No.

◆ getAutoTransferMessageAttachments()

boolean com.hyphenate.chat.EMOptions.getAutoTransferMessageAttachments ( )

Gets whether to upload the message attachments automatically to the chat server.

Returns
Whether to upload the message attachments automatically to the chat server.
  • (Default)true: Yes.
  • false: No. A custom path is used to for uploading.

◆ getCustomDeviceName()

String com.hyphenate.chat.EMOptions.getCustomDeviceName ( )

Gets the custom name of the current device.

Returns
The custom name of the current device.

◆ getCustomOSPlatform()

int com.hyphenate.chat.EMOptions.getCustomOSPlatform ( )

Gets the custom platform code of a login device.

Returns
The custom platform code of the login device.

◆ getDataSyncType()

EnumSet< EMDataSyncType > com.hyphenate.chat.EMOptions.getDataSyncType ( )

Gets the data types to synchronize automatically after login.

Returns
The data sync types.

◆ getDnsUrl()

String com.hyphenate.chat.EMOptions.getDnsUrl ( )

Gets the DNS url.

Returns
The DNS url.

◆ getDohVendor()

int com.hyphenate.chat.EMOptions.getDohVendor ( )

Gets the DoH provider vendor.

Note: This method is for internal SDK use only.

Returns
The DoH provider vendor.

◆ getEnableDNSConfig()

boolean com.hyphenate.chat.EMOptions.getEnableDNSConfig ( )

Gets whether DNS is disabled.

  • (Default) true: Yes;
  • false: No.
Returns
Returns whether to disable DNS.

◆ getFixedInterval()

int com.hyphenate.chat.EMOptions.getFixedInterval ( )

Gets the fixed heartbeat interval.

Returns
The heartbeat interval in seconds.

◆ getImPort()

int com.hyphenate.chat.EMOptions.getImPort ( )

Gets the custom IM server port.

Returns
The custom IM server port.

◆ getImServer()

String com.hyphenate.chat.EMOptions.getImServer ( )

Gets the custom IM message server URL.

Returns
The custom IM message server URL.

◆ getLoginCustomExt()

String com.hyphenate.chat.EMOptions.getLoginCustomExt ( )

Gets the custom device extension information.

Returns
The custom device extension information.

◆ getNativeLibBasePath()

String com.hyphenate.chat.EMOptions.getNativeLibBasePath ( )

Gets the path of native library.

Returns
The specified path of native library. If the path is not set, it is empty.

◆ getNtpServers()

List< String > com.hyphenate.chat.EMOptions.getNtpServers ( )

Gets the custom NTP server address list.

Returns
NTP 服务器地址列表。

◆ getPushConfig()

EMPushConfig com.hyphenate.chat.EMOptions.getPushConfig ( )

Gets the push configurations.

◆ getRequireDeliveryAck()

boolean com.hyphenate.chat.EMOptions.getRequireDeliveryAck ( )

Gets whether the delivery receipt is required.

Returns
Whether the delivery receipt is required.
  • (Default)true: The read receipt is required;
  • false: The read receipt is not required.

◆ getRestServer()

String com.hyphenate.chat.EMOptions.getRestServer ( )

Gets the custom REST server URL.

Returns
The custom REST server URL.

◆ getSDKPlatform()

EMSDKPlatform com.hyphenate.chat.EMOptions.getSDKPlatform ( )

Gets the current SDK platform.

Returns
The current SDK platform.EMSDKPlatform.

◆ getSyncDataWebSocketPort()

int com.hyphenate.chat.EMOptions.getSyncDataWebSocketPort ( )

Gets the WebSocket server port for data synchronization.

Returns
The WebSocket server port for data synchronization.

◆ getSyncDataWebSocketServer()

String com.hyphenate.chat.EMOptions.getSyncDataWebSocketServer ( )

Gets the WebSocket server URL for data synchronization.

Returns
The WebSocket server URL for data synchronization.

◆ getUIKitVersion()

String com.hyphenate.chat.EMOptions.getUIKitVersion ( )

Gets the UIKit version.

Returns
The UIKit version.

◆ getUsingHttpsOnly()

boolean com.hyphenate.chat.EMOptions.getUsingHttpsOnly ( )

Gets whether only HTTPS is used for REST operations.

Returns
Whether only HTTPS is used for REST operations.
  • (Default) true: Only HTTPS is used;
  • false: Both HTTP and HTTPS can be used.

◆ getVersion()

String com.hyphenate.chat.EMOptions.getVersion ( )

Gets the SDK version.

Returns
The SDK version.

◆ getWebSocketPort()

int com.hyphenate.chat.EMOptions.getWebSocketPort ( )

Gets the custom WebSocket server port.

Returns
The custom WebSocket server port.

◆ getWebSocketServer()

String com.hyphenate.chat.EMOptions.getWebSocketServer ( )

Gets the custom WebSocket server URL.

Returns
The custom WebSocket server URL.

◆ isAutoLoadAllConversations()

boolean com.hyphenate.chat.EMOptions.isAutoLoadAllConversations ( )

Gets whether to automatically load all conversations into the memory upon a successful login.

Returns
Whether to automatically load all conversations.
  • (Default)true: Automatically load all conversations.
  • false: Do not automatically load all conversations.

◆ isEnableStatistics()

boolean com.hyphenate.chat.EMOptions.isEnableStatistics ( )

Checks whether the traffic statistics collection is enabled for local messages.

Returns
Whether the message traffic statistics collection is enabled:
  • true: Enabled;
  • (Default)false: Disabled.

◆ isEnableTLSConnection()

boolean com.hyphenate.chat.EMOptions.isEnableTLSConnection ( )

Gets whether the TLS connection is enabled.

Returns
Whether the TLS connection is enabled.
  • true: The TLS connection is enabled.
  • false: The TLS connection is disabled.

◆ isEnableUserInfo()

boolean com.hyphenate.chat.EMOptions.isEnableUserInfo ( )

Gets whether automatic user information management is enabled.

If this feature is disabled:

  1. Sent messages will not carry SenderInfo.
  2. When receiving messages, the SDK will not automatically synchronize the latest group member name cards and user attributes of the message sender.
  3. EMMessage#getSenderInfo() returns null.
  4. EMGroupManager#asyncFetchGroupMembersInfo(String, String, int, EMValueCallBack) returns EMGroupMemberInfo that does not include the name card, user nickname and avatar (avatarUrl) of the group members.
  5. Retrieving data with EMUserInfoManager#fetchUserInfoByUserId(String[], EMValueCallBack) and EMUserInfoManager#fetchUserInfoByAttribute(String[], EMUserInfo.EMUserInfoType[], EMValueCallBack) will not update the local database.
  6. EMUserInfoManager#getUserInfoWithUserIds(String[], EMValueCallBack) will not return local user information.
  7. After a successful login, the SDK will not automatically synchronize the current user's information from the server.
Returns
Whether to enable user information system:
  • true: Enabled.
  • (Default)false: Disabled.

◆ isIncludeSendMessageInMessageListener()

boolean com.hyphenate.chat.EMOptions.isIncludeSendMessageInMessageListener ( )

Whether the sent message is included in EMMessageListener#onMessageReceived(java.util.List).

Returns
Whether the sent message is included in EMMessageListener#onMessageReceived(java.util.List).

◆ isLoadEmptyConversations()

boolean com.hyphenate.chat.EMOptions.isLoadEmptyConversations ( )

Checks whether to include empty conversations when the SDK loads conversations from the local database.

Returns
Whether to include empty conversations when the SDK loads conversations from the local database.
  • (Default)false: Empty conversations are excluded.
  • true: Empty conversations are included.

◆ isSortMessageByServerTime()

boolean com.hyphenate.chat.EMOptions.isSortMessageByServerTime ( )

Gets whether to sort messages by the time when the server received them.

Returns
Returns whether to sort messages by the time when the server received them.
  • (Default)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.

◆ isUseReplacedMessageContents()

boolean com.hyphenate.chat.EMOptions.isUseReplacedMessageContents ( )

Gets whether the server returns the sender the text message with the content replaced during text moderation.

Returns
Whether to return the adjusted message to the sender:
  • true: Yes.
  • (Default) false: No. The server returns the original message to the sender.

◆ regardImportedMsgAsRead()

boolean com.hyphenate.chat.EMOptions.regardImportedMsgAsRead ( )
   \~chinese
   是否将通过服务器导入的消息设置为已读:

   @return 是否将通过服务器导入的消息设置为已读:
   - `true`:将导入消息置为已读。
    - (默认)`false`:不将导入消息置为已读。
   \~english
   Whether to set messages imported from the server side as read.

   @return Whether to set messages imported from the server side as read:
   - `true`: Read. After the messages are imported, the number of unread messages returned by `EMConversation#getUnreadMsgCount() remains unchanged.

remains unchanged.

  • (Default)

false: Unread. After the messages are imported, the number of unread messages returned byEMConversation.getUnreadMsgCount() is increased.

◆ setAcceptInvitationAlways()

void com.hyphenate.chat.EMOptions.setAcceptInvitationAlways ( boolean value)

Sets whether to accept the friend invitation automatically.

Parameters
valueWhether to accept the friend invitation automatically.
  • (Default)true: Accept friend invitation automatically.
  • false: Do not accept friend invitation automatically.

◆ setAppId()

void com.hyphenate.chat.EMOptions.setAppId ( String appId)

Sets the app id.

Parameters
appIdThe app id you got from the console when creating an app.

◆ setAppKey()

void com.hyphenate.chat.EMOptions.setAppKey ( String appkey)

Sets the app key.

Parameters
appkeyThe app key you got from the console when creating an app.

◆ setAreaCode()

void com.hyphenate.chat.EMOptions.setAreaCode ( AreaCode code)

Sets the area code.

Parameters
codeThe area code enum AreaCode. This parameter is used to restrict the scope of accessible edge nodes. The default value is AreaCode#GLOB, indicating that no restriction is placed on the scope of accessible edge nodes. The parameter setting cannot be changed during the app runtime. Passing null keeps the previously stored value unchanged.

◆ setAutoAcceptGroupInvitation()

void com.hyphenate.chat.EMOptions.setAutoAcceptGroupInvitation ( boolean value)

Sets whether to accept a group invitation automatically.

Parameters
valueWhether to accept group invitation automatically.
  • (Default)true: Accept group invitations automatically;
  • false: Do not accept group invitations automatically.

◆ setAutoDownloadThumbnail()

void com.hyphenate.chat.EMOptions.setAutoDownloadThumbnail ( boolean autodownload)

Sets whether to automatically download thumbnails.

Parameters
autodownloadWhether to download the thumbnails automatically.
  • (Default)true: Yes;
  • false: No.

◆ setAutoLoadAllConversations()

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).

Parameters
autoLoadAllConversationsWhether to automatically load all conversations.
  • (Default)true: Automatically load all conversations.
  • false: Do not automatically load all conversations.

◆ setAutoTransferMessageAttachments()

void com.hyphenate.chat.EMOptions.setAutoTransferMessageAttachments ( boolean transfer)

Sets whether to upload the message attachments automatically to the chat server.

Parameters
transferWhether to automatically upload the message attachments to the chat server.
  • (Default) true: Yes.
  • false: No. A custom path is used to for uploading.

◆ setCustomDeviceName()

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#fetchLoggedInDevicesFromServerWithToken(String, String, EMValueCallBack) 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).

Parameters
customDeviceNameThe 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.

◆ setCustomOSPlatform()

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).

Parameters
platformThe custom platform code. The value range is 1-100.

◆ setDataSyncType()

void com.hyphenate.chat.EMOptions.setDataSyncType ( EnumSet< EMDataSyncType > types)

Sets the data types to synchronize automatically after login.

As for the call sequence, this method comes before EMClient#init(Context, EMOptions).

Parameters
typesThe data sync types: Pass null or an empty set to disable data sync.

◆ setDeleteMessagesAsExitChatRoom()

void com.hyphenate.chat.EMOptions.setDeleteMessagesAsExitChatRoom ( boolean delete)

Sets whether to delete the chat room message when leaving the chat room.

Parameters
deleteWhether to delete the chat room message when leaving the chat room:
  • (Default)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.

◆ setDeleteMessagesAsExitGroup()

void com.hyphenate.chat.EMOptions.setDeleteMessagesAsExitGroup ( boolean delete)

Sets whether to delete the group messages when leaving the group.

Parameters
delete
  • (Default)true: Delete the messages when leaving the group.
  • false: Do not delete the messages when leaving a group.

◆ setDnsUrl()

void com.hyphenate.chat.EMOptions.setDnsUrl ( String dnsUrl)

Sets the DNS url.

Parameters
dnsUrlThe DNS url.

◆ setEnableStatistics()

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).

Parameters
enableStatisticsWhether to enable the message traffic statistics collection:
  • true: Enable;
  • (Default)false: Disable.

◆ setEnableTLSConnection()

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).

Parameters
enableTLSConnectionWhether to enable the TLS connection.
  • true: Enables the TLS connection.
  • (Default)false: Disables the TLS connection.

◆ setEnableUserInfo()

void com.hyphenate.chat.EMOptions.setEnableUserInfo ( boolean enableUserInfo)

Sets whether to enable automatic user information management.

If this feature is disabled:

  1. Sent messages will not carry SenderInfo.
  2. When receiving messages, the SDK will not automatically synchronize the latest group member name cards and user attributes.
  3. EMMessage#getSenderInfo() returns null.
  4. EMGroupManager#asyncFetchGroupMembersInfo(String, String, int, EMValueCallBack) returns EMGroupMemberInfo that does not include the name card, user nickname and avatar (avatarUrl) of the group members.
  5. Retrieving data with EMUserInfoManager#fetchUserInfoByUserId(String[], EMValueCallBack) and EMUserInfoManager#fetchUserInfoByAttribute(String[], EMUserInfo.EMUserInfoType[], EMValueCallBack) will not update the local database.
  6. EMUserInfoManager#getUserInfoWithUserIds(String[], EMValueCallBack) will not return local user information.
  7. After a successful login, the SDK will not automatically synchronize the current user's information from the server.

This method must be called before EMClient#init(Context, EMOptions).

Parameters
enableUserInfoWhether to enable automatic user information management:
  • true: Enable this feature.
  • false: Disable this feature.

◆ setFixedHBInterval()

void com.hyphenate.chat.EMOptions.setFixedHBInterval ( int interval)

Sets a fixed heartbeat interval.

If not set, the optimal heartbeat interval is automatically detected.

Parameters
intervalThe interval of heartbeat in seconds. The recommended value range is 30-300.

◆ setImPort()

void com.hyphenate.chat.EMOptions.setImPort ( int imPort)

Sets the custom IM server port.

Parameters
imPortThe custom IM server port.

◆ setIMServer()

void com.hyphenate.chat.EMOptions.setIMServer ( String imServer)

Sets the custom IM message server URL.

Parameters
imServerThe custom IM message server URL.

◆ setIncludeSendMessageInMessageListener()

void com.hyphenate.chat.EMOptions.setIncludeSendMessageInMessageListener ( boolean include)

Sets whether the sent message is included in EMMessageListener#onMessageReceived(java.util.List).

Parameters
includeWhether the sent message is included in EMMessageListener#onMessageReceived(java.util.List).

◆ setLoadEmptyConversations()

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).

Parameters
isLoadEmptyConversationsWhether to include empty conversations when the SDK loads conversations from the local database:
  • true: Empty conversations are included.
  • (Default)false: Empty conversations are excluded.

◆ setLoginCustomExt()

void com.hyphenate.chat.EMOptions.setLoginCustomExt ( @NonNull String ext)

Sets custom extension information for the current device.

If the SDK is not initialized, you need to set the extension information of the current device before you call the method. If the SDK is initialized, you can set the extension information before your next call to the EMClient#loginWithToken(String,String,EMCallBack) method.

Parameters
extThe 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.

◆ setNativeLibBasePath()

void com.hyphenate.chat.EMOptions.setNativeLibBasePath ( @NonNull String path)

Sets the path of the native library.

Parameters
pathThe path of the native library.
  • If the path is empty or the method is not called, the SDK will use system.loadLibrary to search for and load the so library from the default library path.
  • If the path is not empty, the SDK will use System.load to search for and load the so library from the specified path. The path must be a valid private directory path of the app.
  • This method needs to be called before init.

◆ setNtpServers()

void com.hyphenate.chat.EMOptions.setNtpServers ( List< String > servers)

Sets the custom NTP server address list. Format: "host" or "host:port", default port is 123. Servers must be NTPv4-compliant (RFC 5905). This attribute can be set only before SDK initialization.

Parameters
serversNTP 服务器地址列表。

◆ setPushConfig()

void com.hyphenate.chat.EMOptions.setPushConfig ( EMPushConfig pushConfig)

Sets the push options.

Parameters
pushConfigThe push configuration.

◆ setRegardImportedMsgAsRead()

void com.hyphenate.chat.EMOptions.setRegardImportedMsgAsRead ( boolean regardImportedMsgAsRead)
   \~chinese
   设置是否将通过服务器导入的消息设置为已读:

   @return 是否将通过服务器导入的消息设置为已读:
                - `true`:将导入消息置为已读。
                - (默认)`false`:不将导入消息置为已读。
   \~english
   Sets whether to set messages imported from the server side as read.

   @return  Whether to set messages imported from the server side as read:
                - `true`: Read. After the messages are imported, the number of unread messages returned by `EMConversation#getUnreadMsgCount() remains unchanged.

remains unchanged.

  • (Default)

false: Unread. After the messages are imported, the number of unread messages returned byEMConversation.getUnreadMsgCount() is increased.

◆ setRequireDeliveryAck()

void com.hyphenate.chat.EMOptions.setRequireDeliveryAck ( boolean requireDeliveryAck)

Sets whether to require the delivery receipt.

Parameters
requireDeliveryAckWhether the delivery receipt is required.
  • (Default)true: The delivery receipt is required;
  • false: The delivery receipt is not required.

◆ setRestServer()

void com.hyphenate.chat.EMOptions.setRestServer ( String restServer)

Sets the custom REST server URL.

Parameters
restServerThe custom REST server URL.

◆ setSDKPlatform()

void com.hyphenate.chat.EMOptions.setSDKPlatform ( EMSDKPlatform platform)

Sets the current SDK platform.

As for the call sequence, this method comes before EMClient#init(Context, EMOptions).

Parameters
platformThe current SDK platform. EMSDKPlatform.

◆ setSortMessageByServerTime()

void com.hyphenate.chat.EMOptions.setSortMessageByServerTime ( boolean sortByServerTime)

Sets whether to sort messages by the time when the server received them.

Parameters
sortByServerTimeWhether to sort messages by the time when the server received them:
  • (Default)true: Yes;
  • false: No.

◆ setSyncDataWebSocketPort()

void com.hyphenate.chat.EMOptions.setSyncDataWebSocketPort ( int port)

Sets the WebSocket server port for data synchronization.

This setting is typically used in private deployment scenarios.

This method must be called before EMClient#init(Context, EMOptions).

Parameters
portThe WebSocket server port for data synchronization.

◆ setSyncDataWebSocketServer()

void com.hyphenate.chat.EMOptions.setSyncDataWebSocketServer ( String host)

Sets the WebSocket server URL for data synchronization.

This setting is typically used in private deployment scenarios.

This method must be called before EMClient#init(Context, EMOptions).

Parameters
hostThe WebSocket server URL for data synchronization.

◆ setUIKitVersion()

void com.hyphenate.chat.EMOptions.setUIKitVersion ( String uikitVersion)

Sets the UIKit version.

Parameters
uikitVersionThe UIKit version.

◆ setUseReplacedMessageContents()

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).

Parameters
useReplacedMessageContentsWhether to return the adjusted message to the sender:
  • true: Yes.
  • (Default) false: No. The server returns the original message to the sender.

◆ setUsingHttpsOnly()

void com.hyphenate.chat.EMOptions.setUsingHttpsOnly ( boolean _usingHttpsOnly)

Sets whether only HTTPS is used for REST operation.

Parameters
_usingHttpsOnlyWhether only HTTPS is used.
  • (Default)true: Only HTTPS is used;
  • false: Both HTTP and HTTPS can be used.

◆ setWebSocketPort()

void com.hyphenate.chat.EMOptions.setWebSocketPort ( int wsPort)

Sets the custom WebSocket server port.

Parameters
wsPortThe custom WebSocket server port.

◆ setWebSocketServer()

void com.hyphenate.chat.EMOptions.setWebSocketServer ( String wsServer)

Sets the custom WebSocket server URL.

Parameters
wsServerThe custom WebSocket server URL.

The documentation for this class was generated from the following file: