简体   繁体   English

如何在Android上用react-native-push-notification获取所有通知,相当于PushNotificationIOS getDeliveredNotifications?

[英]How to get all notifications with react-native-push-notification on Android, equivalent to PushNotificationIOS getDeliveredNotifications?

When the app is in background or closed, received push notifications go to top bar (Notification Center).当应用程序处于后台或关闭时,收到推送通知 go 到顶部栏(通知中心)。
Later on tapping one notification will open the app and invoke the onNotification callback for that particular message.稍后点击一个通知将打开应用程序并为该特定消息调用 onNotification 回调。 In iOS, getDelievedNotifications returns an array of all pending ones.在 iOS 中,getDelievedNotifications 返回所有未决通知的数组。
How to do it in Android? Android怎么办?

Thanks.谢谢。

(edited: I am using https://github.com/zo0r/react-native-push-notification ) (编辑:我正在使用https://github.com/zo0r/react-native-push-notification

You can use this library - https://github.com/zo0r/react-native-push-notification 您可以使用此库-https: //github.com/zo0r/react-native-push-notification

Weird thing is that this library supports repeat notifications on Android and the react-native base one supports repeat notifications on IOS devices. 奇怪的是,该库支持Android上的重复通知,而react-native库支持IOS设备上的重复通知。

The only way I found to do that in Android is to locally persist the incoming notifications to later check it there is any pending for processing.我在 Android 中找到的唯一方法是在本地保留传入通知,以便稍后检查是否有任何待处理的通知。

You can use getDisplayedNotifications using notifee librery您可以使用 notifee 库使用getDisplayedNotifications

https://notifee.app/react-native/reference/getdisplayednotifications#notifee https://notifee.app/react-native/reference/getdisplayednotifications#notifee

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当应用程序在后台并单击通知时,Android react-native-push-notification onNotification 没有被调用? - Android react-native-push-notification onNotification not called when app is in the background and notification clicked? 反应本机应用程序中的静默推送通知 - silent push notifications in react native app 如何在 React Native 中创建 Firebase 推送通知组? - How to create Firebase push notifications group in React Native? React Native 推送通知,FCM 表示令牌仅在 iOS 上无效(Android 有效) - React Native Push Notifications, FCM says token is invalid on iOS only (Android works) 如何在本机反应中显示所有传递的通知? Firebase - How to display all delivered notifications in react native? Firebase IOS 推送通知不适用于使用 firebase 和 react-native-push-notifications 的 react native - IOS push notifications not working on react native using firebase and react-native-push-notifications React Native Firebase 推送通知 iOS 真实设备 - React Native Firebase Push Notification iOS Real Device 为使用 PWA 构建器构建的应用程序创建本机 Android 推送通知 - Creating native Android push notifications for App built with PWA builder 将 MongoDb、Expo 和 React Native 一起用于推送通知 - Work MongoDb, Expo and React Native together for push notifications 推送通知未显示在 android 上 - Push Notifications are not showing on android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM