I have a Flutter app registered with Firebase for both iOS and Android. The FCM (push notifications) is meant to work for Android as per https://firebase.flutter.dev/docs/messaging/overview/ pretty much out-of-the-box.
Alas, it doesn't.
I added it to pubspec.yaml. I actually added firebase_messaging: ^7.0.3 because anything newer breaks other dependencies. Then I go to Firebase console and send a test message targeted at my Android registered app. Once the message goes through and it says it is Completed no message comes to my simulator.
I know FCM on iOS has an issue with simulator but I have not read anything about it being a case on Android.
I added import 'package:firebase_messaging/firebase_messaging.dart'; and instantiated FirebaseMessaging messaging = FirebaseMessaging(); both in main and results are as above i.e. nothing comes through to my simulator's notifications.
The strangest thing is that I originally followed https://sebastianengel.medium.com/easy-push-notifications-with-flutter-and-firebase-cloud-messaging-d96084f5954f which is substantially more involved and I did get first notification(sic!) but not any subsequent ones. I tried to do this solution from ground up again but the notifications on my simulator remained indifferent.
One thing to bear in mind is that I use few other Firebase services so I know my app is correctly registered with Firebase... unless there's some additional step that I missed and can't see.
Anyone please went through the same ordeal and can pinpoint my blindspot? Thank you.
UPDATE -
I checked error logs and they are empty.
Could you post some more information? For example the console log when you send a notification (try troubleshooting with basic print statements also), better still, send a reproducible snippet of code so I can recreate your problem.
Also make sure you initialize notification handling at a top level function (main preferably).
I'd be happy to work with you, reach me on seanonuoha#gmail.com, when we fix the problem, you post the results here.
Cheers
If you follow the steps in this documentation and still got no message or notification you can check your emulator settings.
Emulator stands default SERIAL CONSOLE DISABLED.
Slide it and turn it to enabled.
My problem solved with this issue.
If you tried and still get problem. Do not hesitate to ask again.
....
Related
So I am compiling Rocket Chat to use my own Firebase server so I can server notifications without worrying about hitting the notification limit. I've followed the steps here and gotten a working Experimental version of the app on Android, but I can't seem to get the notifications to work. Checking Firebase shows no users of my app, though sometimes it will register a single user but that's it. I've got to be missing something simple, but I can't figure out what. Any help or tips would be greatly appreciated! Thanks.
If you need any more information just let me know.\
UPDATE: I can send test notifications from Firebase and they show up on the device, however they are not marked as read in Firebase when clicked. It seems as if notifications work from Firebase, but it has no way to communicate back to Firebase.
FINAL UPDATE: It turns out that Rocket Chat server needs the legacy version of the FCM keys. By replacing the existing google-services.json file with the one provided by Firebase and following the instructions to get the legacy keys caused notifications to work. Hopefully someone else can benefit from this insight.
FINAL UPDATE: It turns out that Rocket Chat server needs the legacy version of the FCM keys. By replacing the existing google-services.json file with the one provided by Firebase and following the instructions to get the legacy keys caused notifications to work. Hopefully someone else can benefit from this insight.
i am not receiving notification after sending it through firebase console , i tried sending many notification but received one or two from around 20 notifications, i followed this guide firebase messaging from github
,why am i not receiving notification, my app is installed in one emulator and in one of my phone but when i receive notification which i have sent through notification panel i get them either on phone or emulator never got them on both.
below is the screenshot of my console
check your android app configuration in firebase console
use a restful client to make the request, i suggest
chrome-extension://aejoelaoggembcahagimdiliamlcdmfm/dhc.html,
there you can see the response of the request, if your request are sent sucessfully or if you have error, and the response tells what kind of error you have
check android app , in the method onMessageReceived and print everything to see if you receive information, besides you can print the property "from" who is the id_number of your proyect, and you can see if the messages come from your firebase android app
check firebase documentation.
I've implemented everything just with the guides and its working pretty well
I solved the same problem.
The problem seems to be the browser compatibility/version. Mozilla Firefox could easily handle this.
Make sure your app is running in the background.
Open the Firebase notification console in the FireFox browser and send notifications.
Make sure token is generated
FirebaseInstanceId.getInstance().getToken();
in my case, the package name defined at firebase console isn't the same as defined on gradle and manifest of the app (i changed it one time in the app), so the app won't be able to receive notifications sent from firebase console.
They both have to be the same!
I did not add a new firebase project, just go to project settings at console and add new android app with another package name and have a look at the newly generated google-services.json and change some lines at you android studio project.
Besides the tips that Pavul Zavala said ، keep this in mind that just data message can received by FirebaseMessagingService even application closed or run in background and notification message can't handle(till this moment) when application run in background.
And all message that sent via FireBase console Contains , they always include a notification key
more detail at :
Push notification works incorrectly when app is on background or not running
In my case, what helped me is creating a new simulator in Android Studio
Few things to check:
in Firebase console https://console.firebase.google.com/ add/configure the project
in Android Studio connect to Firebase - Manu -> Tolls -> Firebase -> Cloud Messaging (Connect, Add FCM to your app)
Send notification from Firebase console
So, again, I recreated Virtual Device (open AVD manger and create the same device with the same API level)
I will be happy if somebody will save the time using this post :)
Ideally it shouldn't behave like that but it might be due to following reasons:
Check the notification priority of your app in the app settings of the device.
You might be sending the token of one particular device, Your target should be User segment.
There are several posts that describe aspects of this issue, but there hasn't yet been a satisfying answer, so I'm attempting to collate them all here in hopes of getting an authoritative answer that can address all of these issues.
After updating Google play services to 8.4.0 push notifications displayed by themselves
Android notification is not showing it's content when app is not running
what does gcm.notification.e=1 stand for, into push notification payload on Android?
The gist of the problem is that if you create a GCM message with data only (i.e. not using the notification field, and thus not intending for it to generate a notification) AND you include content_available=True (which is necessary to get the desired behavior from iOS clients), then since 8.4.0, this generates a undesirable blank notification in Android. Prior to 8.4.0, everything worked just fine.
The specifics of the problem seem to be that if the Android client receives a GCM field it doesn't understand, instead of just ignoring it, it adds an "e=1" field (presumably "e" means error?) as a notification even if there was no notification in the message before, causing it to trigger the code that makes a notification appear, rather than the code that directs it to the application to be handled.
Possible workaround: I imagine that one could keep track on the server of which clients were iOS and which clients were Android, and only include the content_available tag for the iOS clients, and this problem would be solved. However, it wasn't necessary to do this in the past, and my system was built with the idea that I could be agnostic to the client types, as it seems was intended.
The fact that the content_available flag suddenly causes these blank notifications on Android seems like a bug that was newly introduced, but it would be very useful to know if it is in fact a bug that might be fixed in 8.5.0 (in which case I could just build with 8.3.0 for now until 8.5.0 comes out), or if it is intended to be a permanent solution. If this is not going to change, is the correct solution to keep track of which GCM registration IDs belong to iOS devices and which belong to Android devices, and then to send out two separate GCM requests every time?
Thanks in advance for any official responses to this question from the Google team.
Se my answer here. The solution I found is to just send this e field with value zero on my server. For Android it worked, have not tested on iOS yet.
Today I finally got an acknowledgement from Google that this was in fact a bug, and that the fix was rolled out this week. I can also confirm that the behavior I was seeing in 8.3.0 now works the same in 8.4.0, so apparently the fix was done entirely on the server side.
I was also advised that it is in fact best practices to partition your GCM messages on the server side between those going to iOS devices and those going to Android devices, as there may be times in the future where different payloads may be needed for the different platforms.
After upgrading version 9.2.1 push notifications displayed by themselves when application is in background (#dblank solution does not work for me)
Workaround: Remove the notification node for Android
{
"to": "APA91bHun4MxP5egoKMwt2KZFBaFUH-1RYqx...",
"notification": {}, //Remove this node when PUSH to Android devices
"data": {
"key": "value"
}
}
I am using parse's latest SDK with android and i implemented it with my project which also using MaterialViewPager framework from github but for some reason, when i send a push from the web interface (dashboard), it says recipient found but "Push Sent 0".
Your code seems to right but this are many issues with Parse Push for Android. I have experienced same kind of issue many times. Sometimes, push notification arrives late. There are many questions about these problems on SO. Unfortunately, there isn't any solution that works for these situations. The clear solution I found is to use GCM.
instead of trying to solve a problem which i don't really know if it's from my app or parse itself as i tried so many things and wasted 2 weeks on that. I moved from parse to Google Cloud Messaging and it works fine. Push notification sent like instantly.
I can successfully push notifications to an app, and they show up on my Androids notifications, but I can't get the payload into the app.
I've found this plugin: PushPlugin, but I can't seem to get it to work with Parse, since it asks for a GCM ID, and I don't know what to give it from Parse. Also, the plugin doesn't seem to offer a way to register to certain channels, or even get an installation ID from Parse.
If I include this plugin: phonegap-parse-plugin to take care of the installationID/channels stuff, then I get a runtime error that randomly pops up (adb logcat) saying it can't find com.parse.GcmBroadcastReceiver, and the app crashes.
I just want an Ionic app that can receive a push notification from Parse, and simply display it.
I was in the same boat a week ago and trudging through it here's what I've found:
Here's the best fork I could find for the integrating with parse on cordova(ionic) on android and iOS
https://github.com/grrrian/phonegap-parse-plugin
Make sure to rename the ionic plugin add in the instructions to the grrrian repo not the avivais one in the READ.ME
(He wanted to merge the branch, but I think avivais has finished maintaining it, so the PR is sitting dead)
There will be a compile error brought on by the new ionic Crosswalk feature which is trivial (heh.. ) to fix. Follow these instructions:
https://github.com/katzer/cordova-plugin-local-notifications/issues/426#issuecomment-113166439
Lastly, you need to create an Application Class manually as per the instructions. I didn't know how to do it so I made a comment here about it that should be helpful
https://github.com/grrrian/phonegap-parse-plugin/issues/8#issuecomment-118955744
I'm in the midst of trying to figure out why the notification isn't being received while its in the background though..
Hope this helps someone
EDIT:
Turns out it works fine in the background. All the notifications came in overnight. My thought is that Parse throttles if you send too many messages to one user at once