Bidev

Firebase Messaging Not Working in Flutter

4 min readIntermediate

Push notifications sent via Firebase Cloud Messaging (FCM) aren't being received on an Android or iOS device running a Flutter app, even though the send appears to succeed from the Firebase Console or backend.

androidiosflutterfirebasefcmpush-notifications

The Problem

Push notifications sent via Firebase Cloud Messaging (FCM) aren't being received on an Android or iOS device running a Flutter app, even though the send appears to succeed from the Firebase Console or backend.

Symptoms

  • Notification sent successfully from Firebase Console/Admin SDK, but never appears on the device
  • App receives notifications in the foreground but not when backgrounded or terminated (or vice versa)
  • Works on Android but not iOS, or vice versa

Why This Happens

  • google-services.json (Android) or GoogleService-Info.plist (iOS) is missing, outdated, or linked to the wrong Firebase project
  • On iOS, no valid APNs authentication key/certificate is configured in the Firebase Console — FCM relies on Apple's push service for delivery
  • Notification permission was never requested/granted on iOS (or Android 13+, which also requires runtime permission)
  • The FCM device token wasn't retrieved or wasn't sent to the backend triggering the notification
  • No foreground message handler registered — FCM does not automatically display a system notification while the app is in the foreground
  • Missing or incorrectly registered background message handler (must be a top-level or static function)

// quick fix

Confirm the device actually has a valid FCM token and that notification permission was granted — these are the two most common root causes.

Firebase Cloud Messaging failures are almost never a Firebase problem. They're a configuration or platform-permission problem that happens to surface as "the notification never arrived." The Firebase Console showing a successful send tells you the message left Google's servers, not that it reached the device, and that distinction is where most debugging time gets wasted.

iOS has the sharpest edges here. FCM depends entirely on Apple's own push service (APNs) for actual delivery, so if there's no valid APNs key configured in the Firebase Console, no amount of correct Flutter code will make notifications arrive. It's also worth saying plainly: the iOS Simulator cannot receive real remote push notifications at all. If you're testing there and wondering why nothing shows up, that's the entire reason, not a bug in your setup.

The foreground-message gap trips people up for a different reason. FCM intentionally does not show a system notification while your app is open and in the foreground; that's the platform's design, not a missing feature. If you want something to appear on screen while the user is actively in the app, you have to build that UI yourself in the onMessage listener.

How to Fix It

1. Verify configuration and permissions (Android)

Confirm google-services.json in android/app matches the Firebase project you're sending from, and request notification permission at runtime on Android 13+: final status = await FirebaseMessaging.instance.requestPermission(); print(status.authorizationStatus);

2. Verify APNs setup (iOS)

In the Firebase Console under Project Settings > Cloud Messaging, confirm an APNs Authentication Key (or certificate) is uploaded — without it, FCM cannot deliver to iOS devices at all. Also confirm Push Notifications capability is enabled in Xcode's Signing & Capabilities.

3. Request permission and check the token

final settings = await FirebaseMessaging.instance.requestPermission( alert: true, badge: true, sound: true, ); final token = await FirebaseMessaging.instance.getToken(); print('FCM token: \$token'); If getToken() returns null or throws, the app isn't registered with FCM/APNs correctly yet.

4. Handle foreground messages explicitly

FCM does not show a system notification while your app is in the foreground: FirebaseMessaging.onMessage.listen((RemoteMessage message) { // show your own in-app notification/snackbar here });

5. Register a top-level background handler

@pragma('vm:entry-point') Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async { await Firebase.initializeApp(); } void main() { FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler); runApp(MyApp()); }

// common mistakes

  • ×Testing push notifications on the iOS Simulator, which cannot receive real remote push
  • ×Assuming a successful 'send' in the Firebase Console means delivery succeeded
  • ×Forgetting foreground messages need a manually-built UI, unlike background/terminated notifications

How to Verify the Fix

  1. 1.Print and confirm a non-null FCM token on the target device
  2. 2.Send a test message directly to that token from the Firebase Console
  3. 3.Test all three app states separately: foreground, backgrounded, and terminated
  4. 4.On iOS, test on a physical device — APNs does not deliver remote push to the Simulator
Share this

Related Flutter Guides

Skip the boilerplate

Production-ready Flutter starter kit with Firebase Auth, Firestore, Cloud Functions, push notifications, and Clean Architecture — ship your app in days, not months.

Get Flutter Firebase Kit$5

Did this article save you time?

I write these for free. If it helped, a coffee keeps me going — and more articles coming.

Buy me a coffee

Comments

Comments

Leave a comment

0/2000

Comments appear after review.