onNotification not being called when app was killed on iOS #1501
Description
Bug
I am sending local notifications using react-native-background-fetch
. This works good. When the user clicks on a notification I redirect him to a certain screen. This always works in Android.
For iOS it is working when the app is in foreground or background. When the app was killed and the user clicks on a notification, the app launches but the onNotification
handler is not being called.
I call PushNotification.configure
from index.js
, so timing should not be the issue.
I followed the fix here to get onNotification
to work in foreground and background.
Environment info
react-native info
output:
info
React Native Environment Info:
System:
OS: macOS 10.15.5
CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Memory: 4.00 GB / 32.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.16.3 - ~/.nvm/versions/node/v10.16.3/bin/node
npm: 6.13.6 - ~/.nvm/versions/node/v10.16.3/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
API Levels: 23, 26, 27, 28, 29
Build Tools: 23.0.1, 26.0.3, 27.0.3, 28.0.3, 29.0.3
System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64
IDEs:
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.5 => 0.59.5
npmGlobalPackages:
react-native-cli: 2.0.1
Library version: the development branch of this repo for the latest Android notification action fixes
Steps To Reproduce
- Configure the
onNotification
handler inindex.js
- Send a push notification while the app is killed
- Check if the
onNotification
handler was called when the notification is clicked
Describe what you expected to happen:
onNotification
should be called when coming from Foreground/Background or when the app was killed