-
Notifications
You must be signed in to change notification settings - Fork 10
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
Problems with receiving messages #80
Comments
Hey👋 I'm really excited to see a Nextcloud w/ UP app. I will try to look at what might be going wrong today/tmrw. (I'm sure @p1gp1g's android expertise will be helpful if they have time to look too) |
I'm pretty sure something like OneSignal/OneSignal-Flutter-SDK#464 is needed for this to work. Afaict most of that code is copied from https://github.com/firebase/flutterfire/tree/master/packages/firebase_messaging/firebase_messaging/android/src/main/java/io/flutter/plugins/firebase/messaging. So how can we coordinate this? I can put some time into implementing this, but I don't want to do the work if someone else is already working on it. If you want to fix it then do it, because then I can continue working on other stuff for the notifications in the app. |
I did some small refactoring and now at least the notifications work on subsequent runs. Background still not working. |
FluffyChat also uses UP, so maybe I can check what they are doing, because I guess that works. |
What tests did you do ? Because the example (and fluffychat) definitely work in background and/or closed ? |
What do you mean with tests? My implementation just doesn't work. I didn't try the examples yet, because as I said in the second comment I don't want to duplicate efforts if someone is already working on it. I will check the examples now. |
LOL example works in background. Then I'm pretty sure I know what is wrong. The documentation just doesn't help a lot. I'll make a PR towards it to fix it. |
I though you did some tests with the example and you had trouble to receive message with the app in background or closed. PR to improve our doc are very welcomed :) |
Somehow I now don't receive the messages at all already on the Android side (looking at the logs). Message definitely arrives at the distributor. |
I just always get |
Are you trying to use foss_embedded_fcm_distributor ? If so, we should close this issue and continue there. And remind that the foss embedded fcm distrib is still in beta :) |
Yes I'm trying the foss distributor. I can temporarily switch to the non-foss, but I need to use the foss one to publish on f-droid. I don't think the non-foss will help though, because I have the same problem when using nfty. I'll try anyway. |
Tried the same with the non-foss distributor. I don't think any of this is related to the distributor that is used. |
You should try with ntfy then. I don't know if the GCM message is related to your problem but it is definitely dependent on Google Services. Do not forget to wipe data of your app sometime, there might be using introduced in development, not wiped after code changes. I can give a look at your code if it can help. You must receive notifications in background :) |
ntfy also doesn't work in the background |
at this point i kinda suspect another plugin is making problems |
i'll just add all the plugins with native android code to the example app and see if it breaks. |
adding the plugins didn't break it. with nfty i get this log and nothing after that:
|
so i think the broadcast intent is never received. idk why this happens now and used to work before. |
Can you set a breakpoint around there https://github.com/UnifiedPush/android-connector/blob/main/connector/src/main/java/org/unifiedpush/android/connector/MessagingReceiver.kt#L19 ? And/or check your shared pref |
I rebuilt the example app exactly following the docs and it just works. There has to be something weird about my app. |
I copied the android folder to my app and it doesn't work. So that part is fine. I really think it has to be one of the plugins |
removing all plugins from my app also doesn't fix it. i'm kind of out of ideas what it could be tbh. |
I don't know, I haven't seen your code. Maybe you could share it so I can check that. Did you do any change android side ? |
The code is in the MR linked at the top. I have some local changes. I'll try on last time and then you can take a look. |
I pushed the code. Hopefully you can find something. I just recreated the android folder from scratch and added my changes on top, but also no luck. |
You don't need to look at all the changes. |
How can I do that? I don't even know how to include the connector from local sources. |
sorry for being so annoying, this is probably the worst bug i ever had because it doesn't make any sense 🙈 |
No problem, I'll try your code to check that soon ! :) |
i tried adding the android-connector from local sources, but just can't get it working :( |
my time of developing native android apps and fiddeling with java and kotlin is just too long ago. i need help from someone with more expertise in that field |
@p1gp1g did you have a chance to look at my code? i tried some other stuff, but nothing helped at all |
So I gradually add the code again and I got it working now. Really no clue what was wrong. I'll push my code later when I got it all working. |
It works pretty well now that it's reliable :D |
so i think |
That's great to hear! We should document this somewhere. I'll test this with other apps and create an FAQ section on the Flutter page on the website if this keeps on happening (weird that I never noticed it, but I guess when testing I leave the app open longer than I keep flutter run running usually) |
i've fully integrated the notifications in my app now. no more issues so far other than the one i discovered. expect the feature to land in the app very soon! |
Receiving messages works right after initialization.
When restarting the app and receiving a message after that it doesn't work anymore. In the logs I can see the Android code is definitely called.
When the app is in background or closed, receiving a message also doesn't work (same as above with receiving on the Android side).
Maybe these are actually the same problem, I suspect the callback is just never called for some reason.
I tried the embedded FOSS FCM and nfty distributors, both have the same problem and from the logs I collected I'm very confident this problem is distributor independent.
I will try to investigate it a little bit and see if adapting stuff from https://github.com/firebase/flutterfire/blob/master/packages/firebase_messaging/firebase_messaging/android/src/main/java/io/flutter/plugins/firebase/messaging/FlutterFirebaseMessagingBackgroundService.java helps.
The text was updated successfully, but these errors were encountered: