hyphenate_SDK4.0 4.8.0
hyphenate java IM SDK
Classes | Public Member Functions | List of all members
com.hyphenate.chat.EMPushManager Class Reference

Classes

enum  DisplayStyle
 
enum  EMPushAction
 
enum  EMPushRemindType
 

Public Member Functions

void enableOfflinePush () throws HyphenateException
 
void disableOfflinePush (int start, int end) throws HyphenateException
 
EMPushConfigs getPushConfigs ()
 
EMPushConfigs getPushConfigsFromServer () throws HyphenateException
 
void updatePushServiceForGroup (List< String > groupIds, boolean noPush) throws HyphenateException
 
void updatePushServiceForUsers (List< String > userIds, boolean noPush) throws HyphenateException
 
List< String > getNoPushGroups ()
 
List< String > getNoPushUsers ()
 
boolean updatePushNickname (String nickname) throws IllegalArgumentException, HyphenateException
 
void asyncUpdatePushNickname (String nickname, EMCallBack callback)
 
void updatePushDisplayStyle (DisplayStyle style) throws IllegalArgumentException, HyphenateException
 
void asyncUpdatePushDisplayStyle (DisplayStyle style, EMCallBack callback)
 
void setSilentModeForConversation (String conversationId, EMConversation.EMConversationType type, EMSilentModeParam param, EMValueCallBack< EMSilentModeResult > callBack)
 
void clearRemindTypeForConversation (String conversationId, EMConversation.EMConversationType type, EMCallBack callBack)
 
void getSilentModeForConversation (String conversationId, EMConversation.EMConversationType type, EMValueCallBack< EMSilentModeResult > callBack)
 
void setSilentModeForAll (EMSilentModeParam param, EMValueCallBack< EMSilentModeResult > callBack)
 
void getSilentModeForAll (EMValueCallBack< EMSilentModeResult > callBack)
 
void getSilentModeForConversations (List< EMConversation > conversationList, EMValueCallBack< Map< String, EMSilentModeResult > > callBack)
 
void syncSilentModeConversationsFromServer (EMCallBack callBack)
 
void setPreferredNotificationLanguage (String languageCode, EMCallBack callBack)
 
void getPreferredNotificationLanguage (EMValueCallBack< String > callBack)
 
void bindDeviceToken (String notifierName, String deviceToken, EMCallBack callBack)
 
void setPushTemplate (String templateName, EMCallBack callBack)
 
void getPushTemplate (EMValueCallBack< String > callBack)
 
void reportPushAction (JSONObject json, EMPushAction action, EMCallBack callBack)
 

Detailed Description

The offline push manager.

Member Function Documentation

◆ asyncUpdatePushDisplayStyle()

void com.hyphenate.chat.EMPushManager.asyncUpdatePushDisplayStyle ( DisplayStyle  style,
EMCallBack  callback 
)

Updates the display style of push notifications. The default value is DisplayStyle#SimpleBanner.

This is an asynchronous method.

Reference: For the asynchronous method, see updatePushDisplayStyle(DisplayStyle).

Parameters
styleThe display style of push notifications.

◆ asyncUpdatePushNickname()

void com.hyphenate.chat.EMPushManager.asyncUpdatePushNickname ( String  nickname,
EMCallBack  callback 
)

Updates the push display nickname of the current user.

This is an asynchronous method.

If no nickname is set, the user ID of the message sender, instead of the nickname, is indicated in the notification bar. The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. For example, if you change the nickname in the user profile (EMUserInfoManager#updateOwnInfo(EMUserInfo, EMValueCallBack) or EMUserInfoManager#updateOwnInfoByAttribute(EMUserInfo.EMUserInfoType, String, EMValueCallBack)), remember to call this method to update the push nickname to ensure consistency.

Reference: The synchronous method see updatePushNickname(String).

Parameters
nicknameThe push nickname, which is different from the nickname in user profiles.

◆ bindDeviceToken()

void com.hyphenate.chat.EMPushManager.bindDeviceToken ( String  notifierName,
String  deviceToken,
EMCallBack  callBack 
)

Binds the device token to the chat server. If device token is null or "", the device token is unbound from the chat server.

Parameters
notifierNameThe current device ID: FCM - Sender ID; Hawei - App ID; Xiaomi - App ID; Meizu - App ID; OPPO - App Key; Vivo - App ID + "#" + App Key;
deviceTokenDevice token generated by the device manufacturer.
callBack

◆ clearRemindTypeForConversation()

void com.hyphenate.chat.EMPushManager.clearRemindTypeForConversation ( String  conversationId,
EMConversation.EMConversationType  type,
EMCallBack  callBack 
)

Clears the setting of offline push notification type for the conversation. After clearing, the conversation follows the settings of the current logged-in user EMPushManager#setSilentModeForAll(EMSilentModeParam, EMValueCallBack).

Parameters
conversationIdThe conversation ID.
typeThe conversation type.
callBackThe completion callback, which contains the description of the cause to the failure.

◆ disableOfflinePush()

void com.hyphenate.chat.EMPushManager.disableOfflinePush ( int  start,
int  end 
) throws HyphenateException

Disables the offline push within the specified time period (24-hour clock).

This is a synchronous method and blocks the current thread.

Parameters
startThe start hour.
endThe end hour.
Exceptions
HyphenateExceptionA description of the cause of the exception.
Deprecated:
Use EMPushManager#setSilentModeForAll(EMSilentModeParam, EMValueCallBack) instead.

◆ enableOfflinePush()

void com.hyphenate.chat.EMPushManager.enableOfflinePush ( ) throws HyphenateException

Turns on the offline push notification.

This is a synchronous method and blocks the current thread.

Exceptions
HyphenateException
Deprecated:
Deprecated. Use EMPushManager#setSilentModeForAll(EMSilentModeParam, EMValueCallBack) instead.

◆ getNoPushGroups()

List< String > com.hyphenate.chat.EMPushManager.getNoPushGroups ( )

Gets the list of groups for which the offline push is turned off.

This is a synchronous method and blocks the current thread.

Returns
The list of groups for which the offline push is turned off.
Deprecated:
Use EMPushManager#getSilentModeForConversation(String, EMConversation.EMConversationType, EMValueCallBack) instead,get the DND Settings for each conversation to determine

◆ getNoPushUsers()

List< String > com.hyphenate.chat.EMPushManager.getNoPushUsers ( )

Gets the list of user IDs with the offline push notification turned off from the cache.

Note: If you need to get the latest data, call {@Link EmpushManager::getPushConfigsFromServer()} before calling this method.

Returns
The list of users for which the offline push notification is turned off.
Deprecated:
Use EMPushManager#getSilentModeForConversation(String, EMConversation.EMConversationType, EMValueCallBack) instead. Get the do-not-disturb settings for each conversation.

◆ getPreferredNotificationLanguage()

void com.hyphenate.chat.EMPushManager.getPreferredNotificationLanguage ( EMValueCallBack< String >  callBack)

Gets the preferred notification language set by the user.

Parameters
callBackThe completion callback, which contains the description of the cause to the failure.

◆ getPushConfigs()

EMPushConfigs com.hyphenate.chat.EMPushManager.getPushConfigs ( )

Gets the push configurations from the cache.

Returns
The push configurations.

◆ getPushConfigsFromServer()

EMPushConfigs com.hyphenate.chat.EMPushManager.getPushConfigsFromServer ( ) throws HyphenateException

Gets the push configurations from the server.

This is a synchronous method and blocks the current thread.

Returns
The push configurations.
Exceptions
HyphenateExceptionA description of the cause of the exception.

◆ getPushTemplate()

void com.hyphenate.chat.EMPushManager.getPushTemplate ( EMValueCallBack< String >  callBack)

Gets the push template for offline push notifications.

Parameters
callBackThe completion callback, which contains the description of the cause to the failure.

◆ getSilentModeForAll()

void com.hyphenate.chat.EMPushManager.getSilentModeForAll ( EMValueCallBack< EMSilentModeResult callBack)

Gets the do-not-disturb settings of the current login user.

Parameters
callBackThe completion callback, which contains the description of the cause to the failure.

◆ getSilentModeForConversation()

void com.hyphenate.chat.EMPushManager.getSilentModeForConversation ( String  conversationId,
EMConversation.EMConversationType  type,
EMValueCallBack< EMSilentModeResult callBack 
)

Gets the do-not-disturb settings of the conversation.

Parameters
conversationIdThe conversation ID.
typeThe conversation type.
callBackThe completion callback, which contains the description of the cause to the failure.

◆ getSilentModeForConversations()

void com.hyphenate.chat.EMPushManager.getSilentModeForConversations ( List< EMConversation conversationList,
EMValueCallBack< Map< String, EMSilentModeResult > >  callBack 
)

Gets the do-not-disturb settings of specified conversations in batches.

Parameters
conversationListThe conversation list.
callBackThe completion callback, which contains the description of the cause to the failure.

◆ reportPushAction()

void com.hyphenate.chat.EMPushManager.reportPushAction ( JSONObject  json,
EMPushAction  action,
EMCallBack  callBack 
)

Reports the push events.

This is an asynchronous method.

Parameters
jsonValue The value of the EPush field included in the push data.
actionPush event.
callBackThe completion callback, which contains the description of the cause to the failure.

◆ setPreferredNotificationLanguage()

void com.hyphenate.chat.EMPushManager.setPreferredNotificationLanguage ( String  languageCode,
EMCallBack  callBack 
)

Sets the preferred language for push notifications.

Parameters
languageCodeThe language code.
callBackThe completion callback, which contains the description of the cause to the failure.

◆ setPushTemplate()

void com.hyphenate.chat.EMPushManager.setPushTemplate ( String  templateName,
EMCallBack  callBack 
)

Sets the push template for offline push notifications.

Parameters
templateNameThe name of the push template.
callBackThe completion callback, which contains the description of the cause to the failure.

◆ setSilentModeForAll()

void com.hyphenate.chat.EMPushManager.setSilentModeForAll ( EMSilentModeParam  param,
EMValueCallBack< EMSilentModeResult callBack 
)

Sets the do-not-disturb mode for the current login user.

Parameters
paramThe do-not-disturb parameter.
callBackThe completion callback, which contains the description of the cause to the failure.

◆ setSilentModeForConversation()

void com.hyphenate.chat.EMPushManager.setSilentModeForConversation ( String  conversationId,
EMConversation.EMConversationType  type,
EMSilentModeParam  param,
EMValueCallBack< EMSilentModeResult callBack 
)

Sets the do-not-disturb mode of the conversation.

Parameters
conversationIdThe conversation ID.
typeThe conversation type.
paramThe do-not-disturb parameter.
callBackThe completion callback, which contains the description of the cause to the failure.

◆ syncSilentModeConversationsFromServer()

void com.hyphenate.chat.EMPushManager.syncSilentModeConversationsFromServer ( EMCallBack  callBack)

Synchronizes the do-not-disturb status of the conversation with the server. Asynchronous method.

Parameters
callBackThe completion callback, which contains the description of the cause to the failure.

◆ updatePushDisplayStyle()

void com.hyphenate.chat.EMPushManager.updatePushDisplayStyle ( DisplayStyle  style) throws IllegalArgumentException, HyphenateException

Updates the display style of push notifications. The default value is DisplayStyle#SimpleBanner.

Reference: For the asynchronous method, see asyncUpdatePushDisplayStyle(DisplayStyle, EMCallBack).

This is a synchronous method and blocks the current thread.

Parameters
styleThe display style of push notifications.

◆ updatePushNickname()

boolean com.hyphenate.chat.EMPushManager.updatePushNickname ( String  nickname) throws IllegalArgumentException, HyphenateException

Updates the push display nickname of the current user. The nickname that is displayed in the push notification bar of the recipient's client when a message from the user is pushed. If no nickname is set, the user ID of the message sender, instead of the nickname, is indicated in the notification bar. The nickname can be different from the nickname in user attributes. However, Agora recommends that you use the same nickname for both. Therefore, if either nickname is updated, the other should be changed at the same time. For example, if you change the nickname in the user profile (EMUserInfoManager#updateOwnInfo(EMUserInfo, EMValueCallBack) or EMUserInfoManager#updateOwnInfoByAttribute(EMUserInfo.EMUserInfoType, String, EMValueCallBack)), remember to call this method to update the push nickname to ensure consistency.

For the asynchronous method, see asyncUpdatePushNickname(String, EMCallBack).

This is a synchronous method and blocks the current thread.

Parameters
nicknameThe push display nickname, which is different from the nickname in the user profile.

◆ updatePushServiceForGroup()

void com.hyphenate.chat.EMPushManager.updatePushServiceForGroup ( List< String >  groupIds,
boolean  noPush 
) throws HyphenateException

Sets whether to turn off the offline push notification for the the specified groups.

This is a synchronous method and blocks the current thread.

Parameters
groupIdsThe list of groups.
noPush- true: Turns off the notification;
  • false: Turns on the notification.
Exceptions
HyphenateExceptionA description of the cause of the exception.
Deprecated:
Use EMPushManager#setSilentModeForConversation(String, EMConversation.EMConversationType, EMSilentModeParam, EMValueCallBack) instead,set DND Settings for each session.

◆ updatePushServiceForUsers()

void com.hyphenate.chat.EMPushManager.updatePushServiceForUsers ( List< String >  userIds,
boolean  noPush 
) throws HyphenateException

Sets whether to turn off the offline push for specified users.

Parameters
userIdsThe list of users.
noPush- true:turns off the notification;
  • false:turns on the notification.
Exceptions
HyphenateExceptionA description of the cause of the exception.
Deprecated:
Use EMPushManager#setSilentModeForConversation(String, EMConversation.EMConversationType, EMSilentModeParam, EMValueCallBack) instead,set DND Settings for each session

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