agora_chat_SDK 1.0.6
agora java chat SDK
| Public 成员函数 | 所有成员列表
io.agora.chat.PushManager类 参考

enum  DisplayStyle
 
enum  EMPushAction
 
enum  PushRemindType
 

Public 成员函数

void enableOfflinePush () throws ChatException
 
void disableOfflinePush (int start, int end) throws ChatException
 
PushConfigs getPushConfigs ()
 
PushConfigs getPushConfigsFromServer () throws ChatException
 
void updatePushServiceForGroup (List< String > groupIds, boolean noPush) throws ChatException
 
void updatePushServiceForUsers (List< String > userIds, boolean noPush) throws ChatException
 
List< String > getNoPushGroups ()
 
List< String > getNoPushUsers ()
 
boolean updatePushNickname (String nickname) throws IllegalArgumentException, ChatException
 
void asyncUpdatePushNickname (String nickname, CallBack callback)
 
void updatePushDisplayStyle (DisplayStyle style) throws IllegalArgumentException, ChatException
 
void asyncUpdatePushDisplayStyle (DisplayStyle style, CallBack callback)
 
void asyncReportPushAction (String taskId, String provider, EMPushAction action, CallBack callback)
 
void setSilentModeForConversation (String conversationId, Conversation.ConversationType type, SilentModeParam param, ValueCallBack< SilentModeResult > callBack)
 
void clearRemindTypeForConversation (String conversationId, Conversation.ConversationType type, CallBack callBack)
 
void getSilentModeForConversation (String conversationId, Conversation.ConversationType type, ValueCallBack< SilentModeResult > callBack)
 
void setSilentModeForAll (SilentModeParam param, ValueCallBack< SilentModeResult > callBack)
 
void getSilentModeForAll (ValueCallBack< SilentModeResult > callBack)
 
void getSilentModeForConversations (List< Conversation > conversationList, ValueCallBack< Map< String, SilentModeResult > > callBack)
 
void setPreferredNotificationLanguage (String languageCode, CallBack callBack)
 
void getPreferredNotificationLanguage (ValueCallBack< String > callBack)
 
void bindDeviceToken (String notifierName, String deviceToken, CallBack callBack)
 
void setPushTemplate (String templateName, CallBack callBack)
 
void getPushTemplate (ValueCallBack< String > callBack)
 

详细描述

离线消息推送管理类,针对 GCM、小米、华为等离线推送以及 APNS。

成员函数说明

◆ asyncReportPushAction()

void io.agora.chat.PushManager.asyncReportPushAction ( String  taskId,
String  provider,
EMPushAction  action,
CallBack  callback 
)

上报推送事件。

异步方法。

参数
taskId任务ID
provider厂商通道名称
action推送事件

◆ asyncUpdatePushDisplayStyle()

void io.agora.chat.PushManager.asyncUpdatePushDisplayStyle ( DisplayStyle  style,
CallBack  callback 
)

更新推送消息样式,默认是 DisplayStyle#SimpleBanner

异步方法。

参考: 同步方法见 updatePushDisplayStyle(DisplayStyle)

参数
style推送消息样式。

◆ asyncUpdatePushNickname()

void io.agora.chat.PushManager.asyncUpdatePushNickname ( String  nickname,
CallBack  callback 
)

更新当前用户的推送昵称。

异步方法。

离线消息推送的时候可以显示推送昵称而不是用户 ID。 当用户更改昵称(可通过 UserInfoManager#updateOwnInfo(UserInfo, ValueCallBack) 或者 UserInfoManager#updateOwnInfoByAttribute(UserInfo.UserInfoType, String, ValueCallBack) 修改)时,

务必也调用此方法更新到环信服务器,防止显示差异。

参考: 同步方法见 updatePushNickname(String)

参数
nickname推送昵称,需要与用户属性中的昵称区分开。

◆ bindDeviceToken()

void io.agora.chat.PushManager.bindDeviceToken ( String  notifierName,
String  deviceToken,
CallBack  callBack 
)

绑定设备token到环信服务器。 当deviceToken为空时,表示从环信服务器解绑当前设备的deviceToken

参数
notifierName表示当前设备的ID,具体如下: FCM - Sender ID; 华为 - App ID; 小米 - App ID; 魅族 - App ID; OPPO - App Key; Vivo - App ID + "#" + App Key;
deviceToken当前设备返回的设备 Token .
callBack

◆ clearRemindTypeForConversation()

void io.agora.chat.PushManager.clearRemindTypeForConversation ( String  conversationId,
Conversation.ConversationType  type,
CallBack  callBack 
)

清除会话的离线推送提醒类型设置。 清除之后会话跟随当前登录用户的设置 PushManager#setSilentModeForAll(SilentModeParam, ValueCallBack)

参数
conversationId会话id。
type会话类型。
callBack完成回调。

◆ disableOfflinePush()

void io.agora.chat.PushManager.disableOfflinePush ( int  start,
int  end 
) throws ChatException

在指定的时间段(24 小时制)内,不推送离线消息。

同步方法,会阻塞当前线程。

参数
start开始时间。
end结束时间。
异常
ChatException如果有异常会在这里抛出,包含异常原因。
弃用:
使用 PushManager#setSilentModeForAll(SilentModeParam, ValueCallBack) 替代。

◆ enableOfflinePush()

void io.agora.chat.PushManager.enableOfflinePush ( ) throws ChatException

开启离线消息推送。

同步方法,会阻塞当前线程。

异常
ChatException
弃用:
使用 PushManager#setSilentModeForAll(SilentModeParam, ValueCallBack) 替代。

◆ getNoPushGroups()

List< String > io.agora.chat.PushManager.getNoPushGroups ( )

获取关闭了离线消息推送的群组。

同步方法,会阻塞当前线程。

返回
群组列表。
弃用:
使用 PushManager#getSilentModeForConversation(String, Conversation.ConversationType, ValueCallBack) 替代,获取每个会话的免打扰设置来判断。

◆ getNoPushUsers()

List< String > io.agora.chat.PushManager.getNoPushUsers ( )

从缓存中获取关闭了离线消息推送的用户。

注意: 如果需要获取最新的数据可先调用 PushManager#getPushConfigsFromServer() 后,再调用本方法。

返回
关闭了离线消息推送的用户列表。
弃用:
使用 PushManager#getSilentModeForConversation(String, Conversation.ConversationType, ValueCallBack) 替代,获取每个会话的免打扰设置来判断。

◆ getPreferredNotificationLanguage()

void io.agora.chat.PushManager.getPreferredNotificationLanguage ( ValueCallBack< String >  callBack)

获取用户设置的推送翻译语言。

参数
callBack完成回调。

◆ getPushConfigs()

PushConfigs io.agora.chat.PushManager.getPushConfigs ( )

从缓存获取推送配置信息。

返回
推送配置信息。

◆ getPushConfigsFromServer()

PushConfigs io.agora.chat.PushManager.getPushConfigsFromServer ( ) throws ChatException

从服务器获取推送配置信息。

同步方法,会阻塞当前线程。

返回
推送配置信息。
异常
ChatException如果有异常会在这里抛出,包含异常原因。

◆ getPushTemplate()

void io.agora.chat.PushManager.getPushTemplate ( ValueCallBack< String >  callBack)

获取设置的离线推送模版。

参数
callBack完成回调。

◆ getSilentModeForAll()

void io.agora.chat.PushManager.getSilentModeForAll ( ValueCallBack< SilentModeResult callBack)

获取当前登录用户的免打扰设置。

参数
callBack完成回调。

◆ getSilentModeForConversation()

void io.agora.chat.PushManager.getSilentModeForConversation ( String  conversationId,
Conversation.ConversationType  type,
ValueCallBack< SilentModeResult callBack 
)

获取会话的免打扰设置。

参数
conversationId会话id。
type会话类型。
callBack完成回调。

◆ getSilentModeForConversations()

void io.agora.chat.PushManager.getSilentModeForConversations ( List< Conversation conversationList,
ValueCallBack< Map< String, SilentModeResult > >  callBack 
)

批量获取指定会话的免打扰设置。

参数
conversationList会话列表。
callBack完成回调。

◆ setPreferredNotificationLanguage()

void io.agora.chat.PushManager.setPreferredNotificationLanguage ( String  languageCode,
CallBack  callBack 
)

设置用户推送翻译语言。

参数
languageCode语言code。
callBack完成回调。

◆ setPushTemplate()

void io.agora.chat.PushManager.setPushTemplate ( String  templateName,
CallBack  callBack 
)

设置离线推送的推送模版。

参数
templateName模版名称。
callBack完成回调。

◆ setSilentModeForAll()

void io.agora.chat.PushManager.setSilentModeForAll ( SilentModeParam  param,
ValueCallBack< SilentModeResult callBack 
)

设置当前登录用户的免打扰设置。

参数
param离线推送免打扰参数。
callBack完成回调。

◆ setSilentModeForConversation()

void io.agora.chat.PushManager.setSilentModeForConversation ( String  conversationId,
Conversation.ConversationType  type,
SilentModeParam  param,
ValueCallBack< SilentModeResult callBack 
)

设置会话的免打扰。

参数
conversationId会话id。
type会话类型。
param离线推送免打扰参数。
callBack完成回调。

◆ updatePushDisplayStyle()

void io.agora.chat.PushManager.updatePushDisplayStyle ( DisplayStyle  style) throws IllegalArgumentException, ChatException

更新推送消息样式,默认是 DisplayStyle#SimpleBanner

参考: 异步方法见 asyncUpdatePushDisplayStyle(DisplayStyle, CallBack)

同步方法,会阻塞当前线程。

参数
style推送消息样式。

◆ updatePushNickname()

boolean io.agora.chat.PushManager.updatePushNickname ( String  nickname) throws IllegalArgumentException, ChatException

更新当前用户的推送昵称。 离线消息推送的时候可以显示推送昵称而不是用户 ID。 当用户更改昵称(可通过 UserInfoManager#updateOwnInfo(UserInfo, ValueCallBack) 或者 UserInfoManager#updateOwnInfoByAttribute(UserInfo.UserInfoType, String, ValueCallBack) 修改)时, 务必也调用此方法更新到 Chat 服务器,防止显示差异。

参考: 异步方法见 asyncUpdatePushNickname(String, CallBack)

同步方法,会阻塞当前线程。

参数
nickname推送昵称,需要与用户属性中的昵称区分开。

◆ updatePushServiceForGroup()

void io.agora.chat.PushManager.updatePushServiceForGroup ( List< String >  groupIds,
boolean  noPush 
) throws ChatException

设置指定的群组是否接受离线消息推送。

同步方法,会阻塞当前线程。

参数
groupIds要设置的群组列表。
noPush- true:不接收离线消息推送;
  • false:接收推送。
异常
ChatException如果有异常会在这里抛出,包含异常原因。
弃用:
使用 PushManager#setSilentModeForConversation(String, Conversation.ConversationType, SilentModeParam, ValueCallBack) 替代,设置每个会话的免打扰设置。

◆ updatePushServiceForUsers()

void io.agora.chat.PushManager.updatePushServiceForUsers ( List< String >  userIds,
boolean  noPush 
) throws ChatException

设置指定的用户是否接收离线消息推送。

参数
userIds要设置的用户列表。
noPush- true:不接收离线消息推送;
  • false:接收推送。
异常
ChatException如果有异常会在这里抛出,包含异常原因。
弃用:
使用 PushManager#setSilentModeForConversation(String, Conversation.ConversationType, SilentModeParam, ValueCallBack) 替代,设置每个会话的免打扰设置。

该类的文档由以下文件生成: