服务端SDK极光发送用户无感知的静默消息疑问

wangzhipeng2817
2017-06-23 03:27 1.4k 0

            if (StringUtils.isEmpty(jpushMessage.getMessageContent())){
                iosNotificationBuilder.setContentAvailable(true);
                iosNotificationBuilder.disableBadge();
                iosNotificationBuilder.disableSound();
                androidNotificationBuilder.setAlertType(0);

            }else {
                if (jpushMessage.getBadge() != null) {
                    iosNotificationBuilder.setBadge(jpushMessage.getBadge());
                }
            }

            payloadBuilder.setNotification(Notification.newBuilder().
                    addPlatformNotification(iosNotificationBuilder.build())
                    .addPlatformNotification(androidNotificationBuilder.build()).setAlert(jpushMessage.getMessageContent()).build());

我按照rest api里面的参数介绍, 和极光控台发送静默消息的条件在代码中如下设置, 发送的时候依然会有提示,切返回的responsebody中badge有值且为0,
能不能告知正确的发送姿势,急

2个回答

热门排序
  • 1、是需要传空2、Java SDK参考https://community.jiguang.cn/t/ios-badge/12279/7 3、Android静默的,应该推送alert为空的Notification消息、或者自定义消息Messa 展示全部
  • 另外就是客户端也需要配置 请阅读: https://docs.jiguang.cn/jpush/client/iOS/ios_new_fetures/#ios-7-background-remote-notification