【问题标题】:React Native Android remote push notifications not showing upReact Native Android 远程推送通知未显示
【发布时间】:2019-08-23 19:02:19
【问题描述】:

我正在使用 react-native-push-notification 包和 PubNub 推送通知来处理远程通知。这一切在 iOS 上都可以正常工作,我从 android 上的 onNotification 方法获得通知数据,但屏幕上没有像我预期的那样弹出实际通知。我是否可能缺少 FCM 端的配置,或者我需要要求进行特定权限检查以确保可以在 Android 设备上显示远程通知?

我已按照 react-native-push-notification 包上的手动步骤操作到 T 并三次检查我没有错过任何内容

【问题讨论】:

  • 可能不是 PubNub 问题,因为 PubNub 不处理客户端设备上的通知显示。听起来您使用的是正确的 FCM 类型(notification,而不是 data),但请查看这篇知识库文章 Why are my FCM push notifications not working?,以确保一切正常。另外,你能在这里分享你发布的消息负载吗?
  • 从其他地方复制了我的测试通知有效负载,它有某种title_for_mobile 属性,而不是我后来发现的message
  • 那么,您的问题解决了吗?如果没有,您可以分享消息负载吗?

标签: android react-native push-notification pubnub


【解决方案1】:

我传递给 Pubnub 的这个 GCM 位是这个

"pn_gcm": {
    "data": {
      "title_for_mobile": "George Washingtons's phone has moved outside of the group",
      "summary_for_mobile": [ "George Washingtons's phone has moved outside of the group" ],
      "data": {
        "action": "radiusTrigger",
        "userId": 6,
        "groupId": 8
      }
    }
  }

title_for_mobile 没有将其作为推送通知发送到我的手机,所以我不得不将其更改为

"pn_gcm": {
    "data": {
      "message": "George Washingtons's phone has moved outside of the group",
      "data": {
        "action": "radiusTrigger",
        "userId": 6,
        "groupId": 8
      }
    }
  }

现在它会在 android 上显示通知

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多