首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >远程通知不显示react-native-push-notification

远程通知不显示react-native-push-notification
EN

Stack Overflow用户
提问于 2020-07-25 15:02:43
回答 1查看 274关注 0票数 0

我正在使用react-native-push-notification npm包,并在app.But中获取本地和远程通知,但在显示远程通知时遇到问题。它是在onNotification函数中接收的,但不会在应用程序顶部显示。我希望它像本地通知一样。附上截图以获取更多说明:-

这是远程通知的blow代码

代码语言:javascript
复制
PushNotification.configure({
  permissions: {
    alert: true,
    badge: true,
    sound: true,
  },
  senderID: 'XXXXXXXXXX',
  popInitialNotification: true,
  requestPermissions: true,

  onNotification: function(notification) {
      console.log('REMOTE NOTIFICATION==>', notification);
  },
 
  onAction: function (notification) {
    console.log("ACTION:", notification.data.action);
    console.log("NOTIFICATION:", notification);
    // process the action
  }
}); 

并且我在onNotification函数中成功接收远程通知,但这不像本地notification.Payload那样显示在屏幕顶部,远程通知如下:-

REMOTE NOTIFICATION==>{"data": {"action": "3", "alert": "Congrats! You have received food order. Click to see details", "content-available": "3", "job_id": "5f1a7301a1932d281023e7f4", "message": "Congrats! You have received food order. Click to see details", "sound": "default", "status": "3", "type": "FoodDelivery"}, "finish": [Function finish], "foreground": true, "id": "-1753177126", "userInteraction": false}

我想要显示远程通知,如本地通知,屏幕截图附在下面。任何帮助都将不胜感激。

谢谢

EN

回答 1

Stack Overflow用户

发布于 2021-05-01 20:34:48

{"data": {...}} to {"notification": {...}}更改有效负载结构

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63085391

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档