Flutterfire: [FireBase Messaging] iOS only receiving messages in foreground aka. onResume and onLaunch not executing

Created on 11 Jan 2020  路  18Comments  路  Source: FirebaseExtended/flutterfire

Describe the bug
I followed all the instructions in the ios integration instructions on the read me and I am able to receive messages from the firebase console but only when the flutter app is running in the foreground. I am testing this with an iphone 11 max simulator. I set push notifcations on in capabilities as well as background fetch, remote notifications, background processing on in the background modes capabilities.

To Reproduce

  1. Create a widget that instantiates a new firebase message handler, asks for permission, and configures the onMessage, onResume, onLaunch methods and prints the device token.
  1. display this widget in the main.dart file

  2. Run a simulator with flutter run and exit the app and go to the home page

  3. Go to your firebase messaging console and send a message to the printed device token

Expected behavior
I expect to see a notification banner with the message sent from firebase. NOTE ** If the app is open then onMessage method runs fine and a snackbar widget is displayed as desired.

Additional context
None I can think of

crowd ios messaging bug documentation missing-feature

Most helpful comment

Still facing the issue. Any solutions?

All 18 comments

PS. You cant receive notifications on the iOS simulator when you have the app closed. You need to test this on a physical device.

Even with a physical device the notifications never came through.

Is Firebase messaging simply unable to send push notifications in the background or when the app is closed for iOS 13?

Hi @dazednconfusing
I see there's an open issue addressing the case you described.
Please follow up on that issue,
I'm closing the current one as duplicate.
If you disagree please write in the comments
and I will reopen it.
Thank you

The issue you linked to has only a solution for android whereas this is for ios. Additionally, I have found that notifications are not received in the foreground when run through xcode but they are received when run with flutter

I'm having this issue as well.

@dazednconfusing , @acoutts Did you find a solution, I am on a similar boat?

No solution yet..

Still facing the issue. Any solutions?

+1, I receive the notification in the foreground but not in the background although I implemented accordingly to the documentation.

I still have the same issue.
No solution so far?

Any suggestion will be appreciated

Still waiting for any suggestions or fix

facing the same issue -- push notification only received for onMessage but not for the other callbacks (i.e. doesnt work when app is in background / closed)

that's it! moving to one signal

acoutts posted a solution somewhere to disable remote debugging. That solution worked for me on a real device. Earlier it only worked with app in foreground.

it WORKED! OMG FCM don't work on simulators or even if you try plugging your device and making profile, debug, release.... nothing will work until you send a build to Testflight. that's so bad but at least works !

also having this issue

acoutts posted a solution somewhere to disable remote debugging. That solution worked for me on a real device. Earlier it only worked with app in foreground.

Which solution was that? I'm currently stuck on this.

acoutts posted a solution somewhere to disable remote debugging. That solution worked for me on a real device. Earlier it only worked with app in foreground.

Which solution was that? I'm currently stuck on this.

To disable remote debugging; basically uncheck the "Connect via network" box on Device and Simulator window of XCode. This link can help.

Was this page helpful?
0 / 5 - 0 ratings