-
Notifications
You must be signed in to change notification settings - Fork 4k
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] better handling on background isolate initialization #1917
Conversation
by guarding is the flutternativeview has been created once.
unfortunately when running => i get this error.. Edit: I have managed to get this working for Windows (havent tested it on linux or mac, as i think its working fine, reading some related issues, flutter/flutter#15381, flutter/flutter#33964). |
Is this related to #1754 ? |
I think not. Its a bug i have found when pressing the back button and going to home and then reopening the app, you wont receive background notifications anymore |
Reproducing steps: Launch activity and add an background handler for firebase message. I received: "Service took too long to process intent: com.google.android.c2dm.intent.RECEIVE App may get closed." Is this related to #2196? |
I don't know exactly because it never happened to me , or at least I didn't see that error. It has to do more, not been able to receive background notifications, after following the reproducing steps. But I don't know if this problem is solved with newer updates on the plugin... Because it's been like 3 months and I got no responses |
The problem persists. I have tried it in the Beta and Dev channel. I am not sure why it happens ... currently the only test I have not done is using embedding v1., Since I use plugins that I use and they benefit from embedding v2 |
i can try with the new embedding and and inform u, i need some time tho, because i have been in touch with flutter in 2months :( |
hi @fbrus92 i've tried it on a new project with the latest version of messaging 6.0.15, and it seems that it works fine without the error you showed me. (i tested it on a xiaomi phone). But something else got my attention. If u kill the activity (by pressing back for example) and reopen, it creates a new background thread without terminating / reusing the old one, i think i am not 100% percent or maybe i have messed up the registration of the background registrant.
i have tried both with and without the if part. (flutter embedding 2) |
I also tried this version of the plugin (from this commit, i have locally on my pc) and seems to work fine. without the multiple threads problem that is occuring on the previous comment. |
The problem also occurs with the Firebase Messaging version 6.0.15., But this only happens with the messages interpreted by "onBackgroundMessage" { Note that using the following configuration: The number of references to "main" decreased substantially compared to version 6.0.15 and the error doesn't happen anymore !!! I don't see the time that your changes are integrated. :P Hopefully the google team can review it soon @Salakar |
@Fbrusca i am glad it works for you 👍 |
Just had an issue and @spideythewebhead repo worked for me as well. To me the issue started once I've created another background channel. Not sure if it's truly the source though since I've added few other things as well. Either way this PR should get in. |
* Fix annotation dependency * [firebase_auth] Patch increment
Description
Handles the creation of the background isolate/view/channel by adding a guard if its already available.
Reproducing steps:
Related Issues
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze
) does not report any problems on my PR.Breaking Change