bug: when the App is closed completely the notificationActionPerformed listener is not fired
See original GitHub issuePlugin(s):
- “@capacitor-firebase/messaging”: “^0.5.1”
Platform(s):
- iOS
Current behavior:
When the App is closed (killed) completely and a push notification is sent, you open it from the notifications center and the notificationActionPerformed
listener is not fired. I don’t know if notificationReceived
is being called, I see no logs.
Expected behavior:
notificationActionPerformed
should be called when the app is closed completely.
Steps to reproduce: Close the app completely, send a notification and try to open the notification from the notifications center.
Related code:
FirebaseMessaging.addListener('notificationReceived', event => {
console.log('notificationReceived', {event});
});
FirebaseMessaging.addListener('notificationActionPerformed', event => {
console.log('notificationActionPerformed', {event});
});
Payload being sent to FCM API:
{
"to":"/topics/example",
"priority":"high",
"notification":{
"title":"Hi",
"body":"Testing here"
},
"data":{
"title":"Hi",
"body":"Testing here"
}
}
AppDelegate:
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken)
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
NotificationCenter.default.post(name: Notification.Name.init("didReceiveRemoteNotification"), object: completionHandler, userInfo: userInfo)
}
Capacitor config:
PushNotifications: {
presentationOptions: ["badge", "sound", "alert"],
},
The notification is displayed correctly on the phone and in the notification center.
Other information:
My goal is to be able to open a screen when you tab a notification from the notifications center. Right now, is not working because notificationActionPerformed
is not being called.
Imagine when you tab on a notification from WhatsApp and you are redirected to a screen that contains your conversation.
I don’t know if this is a bug or a known limitation where we don’t have a workaround yet.
Others issues that can be related or not:
- No sound is played by default. Not even the iOS default one.
- No badge count is being set above the App icon.
I have read:
- https://github.com/ionic-team/capacitor-plugins/issues/200
- https://github.com/capawesome-team/capacitor-badge/issues/24
Any help is appreciated.
Capacitor doctor:
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 4.0.1
@capacitor/core: 4.0.1
@capacitor/android: 4.0.1
@capacitor/ios: 4.0.1
Installed Dependencies:
@capacitor/cli: 3.6.0
@capacitor/ios: 3.6.0
@capacitor/android: 3.6.0
@capacitor/core: 3.6.0
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:6 (3 by maintainers)
I have the same issue, any idea about it?
@robingenz That version is working good from all points of view, app open/closed/killed, etc… 😃