Android FCM: Not able to see the notification in the notification tray (foreground/background)
See original GitHub issueHi @EddyVerbruggen ,
right now we want to include firebase cloud messaging in our app using your plugin and unfortunately I am not able to see the actual notification in the Android notification tray.
My general configuration: tns-android: 4.2.0 tns-core-modules: 4.2.1 nativescript-plugin-firebase: 7.4.2 device: Motorola X PLay Android 7.1.1
My firebase configuration: { “external_push_client_only”: false, “using_ios”: true, “using_android”: true, “firestore”: false, “realtimedb”: false, “authentication”: false, “remote_config”: false, “messaging”: true, “crashlytics”: false, “crash_reporting”: false, “storage”: false, “functions”: false, “facebook_auth”: false, “google_auth”: false, “admob”: false, “invites”: false, “dynamic_links”: false, “ml_kit”: false }
Please have in mind that I do not know whether this problem also exists in iOS as we plan to publish our app only for Android as a first step.
What I am doing:
firebase.init({
showNotifications: true,
showNotificationsWhenInForeground: true,
onPushTokenReceivedCallback: function(token) {
//...
//send device token to server
},
onMessageReceivedCallback: function(pushNotification) {
console.log("###### onMessageReceivedCallback");
console.log(JSON.stringify(pushNotification));
//... read payload from message and do other stuff...
},
});
Our app creates the following output:
JS: ###### onMessageReceivedCallback JS: {“foreground”:true,“from”:“<our project id>”,“data”:{…}}
So I can see that the app receives the push message as expected and I can read the payload. But the problem is, that I do not see any notification.
When I was push testing push messages in general some weeks ago with one of the previous verions of you plugin (I think it was 7.1.2), I was sending push messages directly via firebase console and I know, that it was working as expected at this time.
I tested versions 7.4.0, 7.3.0 as well, but without success. I also tried to test the older version (where I am sure that I used that for my previous tests) but there I am not able to build the app anymore because of gradle and google services version conflics…
Unfortunately, I am not able to extract this scenario into a sample app project right now. I hope that my description and my configuration can help you to get an idea of what is going wrong here. I hope you can give me a hint what is going wrong here or maybe it is a bug in the plugin source.
Best regards, Felix
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top GitHub Comments
In my case, the type of the push message itself caused this issue. Our backend was sending data messages, so thats why no notification was created in the notification bar.
During my tests witht the firebase console, notification messages were sent and thaty why the notification was created as expected in this case.
@Mia12344 if you have the same problems, have a look here: https://firebase.google.com/docs/cloud-messaging/concept-options
I’ll close this issue, as it was our fault and not a bug in the plugin.
I know this comes under the heading RTFM but it might be useful to add the link to the configuration page as I didn’t know about the date vs notification…