Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sebbyjp opened this issue Jan 11, 2020 · 25 comments
Labels
impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working type: documentation Improvements or additions to documentation type: missing-feature A feature that is supported on the underlying Firebase SDK but has not been exposed to Dart API.

Comments

@sebbyjp
Copy link

sebbyjp commented Jan 11, 2020

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.

  2. display this widget in the main.dart file

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

  4. 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

@Theunodb
Copy link

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

@sebbyjp
Copy link
Author

sebbyjp commented Jan 16, 2020

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?

@iapicca
Copy link

iapicca commented Jan 21, 2020

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

@iapicca iapicca closed this as completed Jan 21, 2020
@sebbyjp
Copy link
Author

sebbyjp commented Jan 26, 2020

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

@iapicca iapicca reopened this Feb 12, 2020
@acoutts
Copy link

acoutts commented Mar 11, 2020

I'm having this issue as well.

@gdagitrep
Copy link

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

@acoutts
Copy link

acoutts commented Mar 20, 2020

No solution yet..

@krishnakumarcn
Copy link

Still facing the issue. Any solutions?

@SamerDiab
Copy link

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

@campioncino
Copy link

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

Any suggestion will be appreciated

@bougsid
Copy link

bougsid commented Apr 20, 2020

Still waiting for any suggestions or fix

@yudi-tan
Copy link

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)

@Salakar Salakar added platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: documentation Improvements or additions to documentation type: missing-feature A feature that is supported on the underlying Firebase SDK but has not been exposed to Dart API. impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) labels Apr 21, 2020
@misaelriojasftf
Copy link

that's it! moving to one signal

@gdagitrep
Copy link

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.

@misaelriojasftf
Copy link

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 !

@kaarens93

This comment has been minimized.

@Fatimamostafa
Copy link

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.

@gdagitrep
Copy link

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.

Ehesp pushed a commit that referenced this issue Oct 20, 2020
…eturned map (#1799)

* make sure the keys are actually added to the returned map

* Add testing, removed a print
@Codepeaker
Copy link

Codepeaker commented Dec 23, 2020

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 !

Does that really work for anybody else

@acoutts
Copy link

acoutts commented Dec 23, 2020

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 !

Does that really work for anybody else

No it will work if you plug in a phone and build locally for it. Simulators will not receive pushes will receive data messages. They will still get notifications sent to FCM but they come through as a data message and will have the notification data the same as a real device. The best way to test is with a physical phone.

@jkz27
Copy link

jkz27 commented Jan 15, 2021

@acoutts by testing with a physical device do you mean to build the app on a physical device through Xcode or submit it to test flight? It is working completely fine for me on android, and on IOS I followed the steps of requesting permissions and setup but I am receiving nothing on the background/quit state, even though I build it through Xcode on a physical device

@Ehesp
Copy link
Member

Ehesp commented Jan 18, 2021

As long as the app is running on a physical device it's fine, whether it's a debug/prod build or not. It just needs to be on a physical one.

We did mention this in the new docs:

image

I'd also suggest upgrading to v8 if possible.

@russellwheatley
Copy link
Member

Hey @dazednconfusing, do you mind upgrading to the latest version: 9.1.2, trying on a physical device and updating this thread? thanks.

@icodeyou
Copy link

I have the same problem, even with my physical device.

@russellwheatley
Copy link
Member

Due to lack of response from OP combined with a number of major release version iterations and much more detailed docs regarding ios messaging setup. I'm going to close this issue and ask any that any new problems with the current version be created as a new issue.

@firebase firebase locked and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) platform: ios Issues / PRs which are specifically for iOS. plugin: messaging type: bug Something isn't working type: documentation Improvements or additions to documentation type: missing-feature A feature that is supported on the underlying Firebase SDK but has not been exposed to Dart API.
Projects
None yet
Development

No branches or pull requests