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.
Related
I have an android application that uses FCM to get notifications.
I'm using this versions:
implementation "com.google.firebase:firebase-analytics-ktx:17.4.3"
implementation "com.google.firebase:firebase-inappmessaging-display-ktx:19.0.7"
implementation "com.google.firebase:firebase-messaging:20.2.0"
The problem that I've encountered recently is that I tried to send push notification with my own backend server via REST API call. I noticed that for every single api call, android devices get notifications twice.
So I've checked this Question: Firebase send push notification twice and I noticed that like Tom Bevelander's answer, I have a third party lib that uses GCM behind and when I removed that lib from project, problem fixed.
So I have to force my users to update the application. but I don't really want this approach. Something that I saw is that on previous version (GCM included app) when I'm testing push notification with Firebase Panel itself, everything works fine and devices get single notification. but with api call, devices get duplicate notifs. What is the difference between this approaches? How can I find out whats happening behind the FirebasePanel? So that I call same api that panel uses itself?
The endpoints that I've tested is this:
https://fcm.googleapis.com/fcm/send
and this:
https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send
brother may shore the device token is maybe duplicate like two users sign in from the same device and both user device token is same and server through a notification on the base of device token .so it throughs notification twice if he found the same token twice or more.
I faced a problem that my app can't connect to firebase any more I just deleted my app from firebase project and added it to another project, after that my application can't connect to firebase and I have this message loading
Checking if the app has communicated with our servers. You may need to uninstall and reinstall your app.
and when I try to send FCM notification it not send I have this error message
"error": "MismatchSenderId"
Your app must communicate first with your Firebase project before you start sending any FCM notifications and start using other services.
I recommend you to read this documentation:
https://firebase.google.com/docs/android/setup?authuser=0
Make sure that you enter the package name that your app is actually using. You cannot add or modify this value after you register your app with your Firebase project.
And please make sure that you deleted old google-services.json file from your app directory and replaced it with the new one. You can find documentation on this here: https://support.google.com/firebase/answer/7015592?authuser=0
After all these changes, it is recommended that you uninstall your app from the emulator/physical device first, then install it again. Open it a few times, wait for a few minutes and the app should be connected to your firebase project.
I had the exact problem. Google JSON was fine, had uninstalled the app and updated the fcm server key but it didn't work.
In the end, all I did was to:
-uninstall the app again
-restart my device
-clean project
-invalidate caches and restart
and it started working.
I want to do FCM in Xamarin.Android.
So I following this tutorial (Xamarin.Android)Remote Notifications with Firebase Cloud Messaging to do.
but my phone can't receive message.
my output get :
[FirebaseMessaging] Unable to log event: analytics library is missing
I had add two NuGet:
Xamarin.GooglePlayServices.Base.
Xamarin.Firebase.Messaging.
I tried this Xamarin.Android
Updating Xamarin.Build.Download to 0.4.11
but it's still not working...
What can I do ?
I am at the same step and faced the same situation, until I read forward and found this:
On the Android device (or emulator), background the app by tapping the Android Overview button and touching the home screen. When the device is ready, click SEND MESSAGE in the Firebase Console:
By doing it that way the message can be seen at the notification bar:
I am new to this but I am realizing that the purpose of this first test is to receive the message when the app is not in the foreground... See also: Send Message paragraph in the Remote Notifications with Firebase Cloud Messaging tutorial.
I created an Android App with Android Studio. Now I want to do push notifications with Google Firebase.
I have everything set up.
Everything is working well.
This is the problem:
When I send a cloud message to my device as a test, it works. However, when I send a cloud message normally, not as a test, nothing happened.
It does work with Android Studio.
It makes no difference if the app is open or closed.
Why does it not work?
If use Android upper Oreo. Need setup channel id and configurate him (sound, priority) https://developer.android.com/training/notify-user/channels
and after in firebase message add channel id.
I have configured a Push Notifications at ServiceNow for a custom Android app. After triggering a specific event, the notification stuck in system log with "Pending" type.
Here are more details:
The user can login to custom APP on mobile device, and got registered in sys_push_notif_app_install table;
The event triggers a push notification and it is successfully written to System Log;
In system log I can see the message itself, where the registered device token is also mentioned.
Now the message remains “Pending” for specific period of time, after what turns to “failure”.
We have a Push Application configured in ServiceNow, that contains Goolge API key and “REST API” value for both Push and Feedback.
I can also see 2 error messages in System Log:
app="Push app name" origin="push.feedback"
Invalid Feedback REST Message: no thrown error
app="Push app name" origin="push.feedback" elapsed=8
exception encountered getting feedback:
java.lang.RuntimeException: feedback job does not have a valid
Feedback REST Message: com.glide.push.feedback.FeedbackClientRest.getFeedback(FeedbackClientRest.java:52)
Any ideas are highly appreciated.
I was finally able to solve it. The key point here, is to make sure the Push Application setup is correct. This is something not clearly stated in official docs. So for Android app, these points are important:
Push = Direct,
Feedback = REST,
Google API key = FCM Server Key (both leagacy and the new one are working fine).
Despite Google recommendations to set up HTTP headers for the REST message, the notifications are running fine both with- and without it. Therefore, normally you can leave out-of-the-box REST "Google Cloud Messaging Sent" unchanged.