我如何检测即将到来的通知并在应用程序关闭时进行一些更改...
我正在使用expo-notifications https://docs.expo.io/versions/latest/sdk/notifications/
最佳答案
您的应用在关闭/后台运行时不会收到通知,直到用户与其交互。
If the notification is triggered while the app is in background,
it’s presented immediately
the application is not informed of this
If the notification is triggered while the app is in foreground,
the application not only receives immediate information about this, but…
it can also decide at runtime whether to display a heads-up alert or play a sound! (For more information see the Notification Handler documentation.)
来自Notifications overview ,有 2 个监听器:
addNotificationReceivedListener - This listener is fired whenever a notification is received while the app is foregrounded
addNotificationResponseReceivedListener - This listener is fired whenever a user taps on or interacts with a notification (works when app is foregrounded, backgrounded, or killed)
Notifications SDK也是一个很好的引用。
关于javascript - Expo 推送通知检测,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63820364/