I use FirebaseX to receive notification in my application. I correctly receive notification in the background. But when the app is in the foreground, nothing happens...
I have searched for this problem, but nothing works for me. I have try to had the following data in the data content (when server call url to send notification) [notification_foreground] => true [tap] => true
Here is my plugin list :
cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-fcm-with-dependecy-updated 3.0.0 "Cordova FCM Push Plugin"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-firebasex 5.0.0 "Google Firebase Plugin"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.1.1 "cordova-plugin-ionic-webview"
cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
cordova-plugin-speechrecognition 1.1.2 "Speech Recognition"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
ionic info:
Ionic:
Ionic CLI : 5.2.8
Ionic Framework : @ionic/angular 4.9.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1
Cordova:
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.1, (and 23 other plugins)
Utility:
cordova-res : 0.5.1
native-run : 0.2.7
System:
NodeJS : v10.16.0
npm : 6.10.1
OS : Windows 10
the code to subscribre to the message...
this.firebase.onMessageReceived().subscribe(notification => {
console.log('NOTIFICATION !!!!');
console.log(notification);
alert( JSON.stringify(notification) );
if (notification['tap']) {
this.navCtrl.navigateRoot('/test');
} else {
alert( JSON.stringify(notification) );
}
});
When the app is in the background, I receive the notification and when I tap on it, I have the alert message and console log.
But when the app is in the foreground, nothing is displayed.
Thanks for your help.
cordova-plugin-firebasex plugin isn't working with cordova-plugin-local-notification plugin I have already faced this issue into my current ionic ios application but with the android, it's working perfectly
According to @dpa99c
The problem is that both this plugin and cordova-plugin-local-notifications implements the same UNUserNotificationCenterDelegate willPresentNotification delegate and since delegates have a 1:1 relationship with their parent class, only one of the delegates is being called - in this case, the cordova-plugin-firebasex delegate in response to the notification created by cordova-plugin-local-notifications.
Please check the below link for the details description
https://github.com/dpa99c/cordova-plugin-firebasex/issues/230
Solution: Please use this local notification plugin with cordova-plugin-firebasex It's working perfectly in android and iOS both platform
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With