Firebase Cloud Messaging not working on Android with Flutter app

Viewed 1938

I have a Flutter app registered with Firebase for both iOS and Android. The FCM (push notifications) is meant to work for Android as per https://firebase.flutter.dev/docs/messaging/overview/ pretty much out-of-the-box. Alas, it doesn't.

  1. I added it to pubspec.yaml. I actually added firebase_messaging: ^7.0.3 because anything newer breaks other dependencies. Then I go to Firebase console and send a test message targeted at my Android registered app. Once the message goes through and it says it is Completed no message comes to my simulator. I know FCM on iOS has an issue with simulator but I have not read anything about it being a case on Android.

  2. I added import 'package:firebase_messaging/firebase_messaging.dart'; and instantiated FirebaseMessaging messaging = FirebaseMessaging(); both in main and results are as above i.e. nothing comes through to my simulator's notifications.

  3. The strangest thing is that I originally followed https://sebastianengel.medium.com/easy-push-notifications-with-flutter-and-firebase-cloud-messaging-d96084f5954f which is substantially more involved and I did get first notification(sic!) but not any subsequent ones. I tried to do this solution from ground up again but the notifications on my simulator remained indifferent.

One thing to bear in mind is that I use few other Firebase services so I know my app is correctly registered with Firebase... unless there's some additional step that I missed and can't see.

Anyone please went through the same ordeal and can pinpoint my blindspot? Thank you.

UPDATE - I checked error logs and they are empty. enter image description here

2 Answers

Could you post some more information? For example the console log when you send a notification (try troubleshooting with basic print statements also), better still, send a reproducible snippet of code so I can recreate your problem.

Also make sure you initialize notification handling at a top level function (main preferably).

I'd be happy to work with you, reach me on seanonuoha@gmail.com, when we fix the problem, you post the results here.

Cheers

If you follow the steps in this documentation and still got no message or notification you can check your emulator settings. Emulator stands default SERIAL CONSOLE DISABLED. Slide it and turn it to enabled. My problem solved with this issue.

If you tried and still get problem. Do not hesitate to ask again.

....

EMULATOR notification status

Related