onNotification isn't gets called on receiving local notification.
See original GitHub issueonNotification is not even gets called on the example app on receiving notification.
While triggering instant local notification or scheduled notification, onNotification isn’t gets called on receiving. It gets called after user perform an action on the received push notification. At the readme, it is stated that onNotification gets invoked as soon as a notification is received and when user performs an action. I have tested it for Android. But it is not happening. I checked both on emulator as well as real device.
Environment info
react-native info
output:
System:
OS: macOS 10.15.3
CPU: (8) x64 Intel® Core™ i7-4770HQ CPU @ 2.20GHz
Memory: 797.71 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
Yarn: 1.22.0 - /usr/local/bin/yarn
npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.8.4 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 23, 28, 29
Build Tools: 28.0.3, 29.0.2
System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 11.3.1/11C505 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_222 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
react-native: Not Found
Library version: 3.3.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:21
Top GitHub Comments
I still haven’t found a way and I still have a use case for this exact purpose. I think we need this functionality.
This would be a great addition! I’m using scheduled local notifications and would love to be able to have my foreground-state app be aware of when a notification was delivered. Unless there is some other way to listen for this event?