question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android FCM: Not able to see the notification in the notification tray (foreground/background)

See original GitHub issue

Hi @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:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
felixkrautschukcommented, Nov 26, 2018

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.

0reactions
nlmunrocommented, Mar 24, 2019

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…

Read more comments on GitHub >

github_iconTop Results From Across the Web

FCM Notification not showing in System tray on android device
I am trying to notification from Firebase Console to android application. I am getting notification data in application but I am not able...
Read more >
Receive messages in an Android app - Firebase - Google
Receive messages in an Android app ... Firebase notifications behave differently depending on the foreground/background state of the receiving app. If you want ......
Read more >
Firebase Notifications in Background & Foreground in Android
We will talk about here for one reason of app being in background and foreground and see how it can be solved. Firebase...
Read more >
Background notification in flutter. Refresh the page, check ...
A notification will appear in the device tray if the app is closed when you send it. Know this! This plugin only works...
Read more >
awesome_notifications | Flutter Package - Pub.dev
Create Local Notifications on Android, iOS and Web using Flutter. ... you will be capable to achieve all Firebase Cloud Messaging features +...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found