Class PushApi


  • public class PushApi
    extends java.lang.Object
    推送API。
    • Constructor Summary

      Constructors 
      Constructor Description
      PushApi​(Context context)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      reactor.core.publisher.Mono<java.lang.Void> closeNotificationNoDisturbing​(java.lang.String username)
      取消推送免打扰。
      reactor.core.publisher.Mono<java.lang.Void> offlineSetting​(java.lang.String username, EMConversationType conversationType, java.lang.String conversationId, EMNotificationType notificationType, java.lang.String ignoreInterval, long ignoreDuration)
      设置离线推送设置
      reactor.core.publisher.Mono<java.lang.Void> openNotificationNoDisturbing​(java.lang.String username, int startTime, int endTime)
      设置推送免打扰。
      reactor.core.publisher.Mono<java.lang.Void> setNotificationDisplayStyle​(java.lang.String username, DisplayStyle style)
      设置推送消息展示方式,指客户端的推送通知栏展示消息的样式。
      reactor.core.publisher.Mono<java.lang.Void> updateUserNickname​(java.lang.String username, java.lang.String nickname)
      设置推送昵称。
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PushApi

        public PushApi​(Context context)
    • Method Detail

      • updateUserNickname

        public reactor.core.publisher.Mono<java.lang.Void> updateUserNickname​(java.lang.String username,
                                                                              java.lang.String nickname)
        设置推送昵称。

        API使用示例:

         
         EMService service;
        
         try {
             service.push().updateUserNickname("username", "nickname").block();
         } catch (EMException e) {
             e.getErrorCode();
             e.getMessage();
         }
         
        Parameters:
        username - 用户名
        nickname - 推送昵称
        Returns:
        Mono
        See Also:
        设置推送昵称
      • setNotificationDisplayStyle

        public reactor.core.publisher.Mono<java.lang.Void> setNotificationDisplayStyle​(java.lang.String username,
                                                                                       DisplayStyle style)
        设置推送消息展示方式,指客户端的推送通知栏展示消息的样式。

        API使用示例:

         
         EMService service;
        
         try {
             service.push().setNotificationDisplayStyle("username", DisplayStyle.DETAILS).block();
         } catch (EMException e) {
             e.getErrorCode();
             e.getMessage();
         }
         
        Parameters:
        username - 用户名
        style - 展示方式,DEFAULT 仅通知,DETAILS 通知以及消息详情
        Returns:
        Mono
        See Also:
        设置推送消息展示方式
      • openNotificationNoDisturbing

        public reactor.core.publisher.Mono<java.lang.Void> openNotificationNoDisturbing​(java.lang.String username,
                                                                                        int startTime,
                                                                                        int endTime)
        设置推送免打扰。

        设置 IM 用户免打扰,在免打扰期间,用户将不会收到离线消息推送。

        API使用示例:

         
         EMService service;
        
         try {
             service.push().openNotificationNoDisturbing("username", 10, 13).block();
         } catch (EMException e) {
             e.getErrorCode();
             e.getMessage();
         }
         
        Parameters:
        username - 用户名
        startTime - 免打扰起始时间,单位是小时
        endTime - 免打扰结束时间,单位是小时
        Returns:
        Mono
        See Also:
        设置推送免打扰
      • closeNotificationNoDisturbing

        public reactor.core.publisher.Mono<java.lang.Void> closeNotificationNoDisturbing​(java.lang.String username)
        取消推送免打扰。

        设置 IM 用户免打扰,在免打扰期间,用户将不会收到离线消息推送。

        API使用示例:

         
         EMService service;
        
         try {
             service.push().closeNotificationNoDisturbing("username").block();
         } catch (EMException e) {
             e.getErrorCode();
             e.getMessage();
         }
         
        Parameters:
        username - 用户名
        Returns:
        Mono
        See Also:
        设置推送免打扰
      • offlineSetting

        public reactor.core.publisher.Mono<java.lang.Void> offlineSetting​(java.lang.String username,
                                                                          EMConversationType conversationType,
                                                                          java.lang.String conversationId,
                                                                          EMNotificationType notificationType,
                                                                          java.lang.String ignoreInterval,
                                                                          long ignoreDuration)
        设置离线推送设置
        Parameters:
        username - 用户名
        conversationType - 会话类型
        conversationId - 会话Id,单聊时为对端用户的用户 ID,群聊时为群组 ID
        notificationType - 离线推送通知方式
        ignoreInterval - 离线推送免打扰时间段,精确到分钟,格式为 HH:MM-HH:MM,例如 08:30-10:00。 该时间为 24 小时制,免打扰时间段的开始时间和结束时间中的小时数和分钟数的取值范围分别为 [00,23] 和 [00,59]。 免打扰时段的设置仅针对 app 生效,对单聊或群聊不生效。如需设置 app 的免打扰时段,type 指定为 user,key 指定为当前用户 ID
        ignoreDuration - 离线推送免打扰时长,单位为毫秒。该参数的取值范围为 [0,604800000],0 表示该参数无效,604800000 表示免打扰模式持续 7 天
        Returns:
        Mono
        See Also:
        设置离线推送设置