Jeepeng / react-native-xinge-push

信鸽推送React Native版,支持华为、小米、魅族官方推送通道
Apache License 2.0
78 stars 29 forks source link

点击通知有回调吗 #18

Closed musicode closed 6 years ago

musicode commented 6 years ago

如题

musicode commented 6 years ago

顺便再问个问题,如果手机收到多条通知,点击其中一条,怎样让其他通知一起消失呢

musicode commented 6 years ago

@Jeepeng 拜托拜托

musicode commented 6 years ago

@Jeepeng 我用两个华为 mate9 测试,当 app 处于后台时,一个能收到通知,一个收不到,但是当 app 处于前台时,两个手机都能收到,请问这是为什么啊

Jeepeng commented 6 years ago

通过notification.clicked === true来判断是否点击通知了

XGPush.addEventListener('notification', this._onNotification);
_onNotification(notification) {
    if(notification.clicked === true) {
      alert('点击通知' + JSON.stringify(notification));
    } else {
      alert('app处于前台时收到通知' + JSON.stringify(notification));
    }
  }
Jeepeng commented 6 years ago

目前信鸽没有提供让通知消失的 API

musicode commented 6 years ago

好的,谢谢。

musicode commented 6 years ago

今天会发新版么

Jeepeng commented 6 years ago

今天晚上

musicode commented 6 years ago

好的,谢谢,我这目前就发现两个相同系统版本的华为 mate9,一个正常,一个后台接收不到通知,其他没啥问题

musicode commented 6 years ago

都是 android 8,targetSdk 版本我改成了 25

adam-zhu-1991 commented 6 years ago

我是通过附加参数来判断点击通知后跳转到哪个页面。

当 app 处于后台时,能收到通知,但是 当打开 app 时 onNotification 不会被触发,app 在前台的时候是可以的。请问这个怎么处理?