Is there any Possible way for getting the status of the push notificatioin wheater it is queued for sending or already Send.
I had posted some push notifications to gcm server but customers didnt got it.
Is there any possible way for getting the status of the notification
There is no way to get the status of an individual message from GCM server.
The response you get from Google only tells you whether your message was valid and accepted by GCM server.
Once the message reaches your app, the only way for your server to know about it is if your app notifies the server as part of handling the message. That's something you'll have to implement yourself, with an API call to your server.
Other then that, if a message was accepted by GCM server and didn't reach the app, you have no way of knowing whether Google attempted to deliver it or not.
Related
This is really a continuation of another question I posted, except now I'm using Azure's push notification telemetry and Google discontinued FCM diagnostics in the Play Console.
I get reports from users saying they haven't received notifications. But the Azure telemetry shows results like these, even for these notifications:
"GcmOutcomeCounts": {
"Outcome": {
"Name": "Success",
"Count": "1"
}
}
Crashlytics shows no crashes, so the only thing I've come up with is putting calls to a logging API in to see where it fails or stop working, but it never even reaches the app in this case.
There has to be a way of figuring out exactly where and why the notification fails. What is it?
There has to be a way of figuring out exactly where and why the notification fails. What is it?
Here is my 2 cents. In general, there can be many points of failure for notifications. Your aim would be to figure out which at which point the issue lies. Below is the diagram from the home page of FCM:
Potential failure points:
When the app sends registration token to your server.
Handling update of the FCM registration token.
If there is an error sending registration token, then you can have a
custom non-fatal exception send to Crashlytics. Since you already
seem to have the token I don't think it is the issue. However in
some cases the token might change, so just double check that
you are implementing onNewToken() and sending the new registration
token to server in case its changing.
When sending notification from your server to FCM.
When sending it from FCM to user device.
To confirm if there is no issue when sending the notification from
your server -> FCM -> user device, you can try getting a delivery
receipt from FCM as mentioned here: Receive delivery
receipts.
It says:
For Android and Chrome client apps, you can get delivery receipts (sent from FCM to your app server) when a device confirms that it received a message sent by FCM.
To enable this feature, the message your app server sends to FCM must include the field delivery_receipt_requested. When this field is set to true, FCM sends a delivery receipt when a device confirms that it received a particular message.
Also, I've seen sometimes issues with firewall on the user's network, back in days when there was GCM. There could be an issue where firewall is blocking the notification. IP range of google GCM push notification server? Try opening the potential list of ports if that's the case or try testing on carrier data network. Since you mention that you've to include log at various points in the app but it never reaches. Looking into the above points can be the next steps.
Handling notification within your app / showing the notification in the notification drawer.
Hope this helps a bit in debugging your issue.
According to the Firebase Cloud Messaging documentation if the app server sets a field "delivery_receipt_requested" in the upstream message, it will receive a delivery confirmation when the app confirms receipt. However it works only if app server is connected with XMPP connection server. It will not work for HTTP connection server.
I'm very new to GCM/FCM and haven't setup my server yet. Hence am working with Firebase console to test my app for notification receipts.
So, following are my queries.
Will the field "delivery_receipt_requested" be sent to the app or the connection server itself will consume it.?
If the app receives this field in a notification will it need to act differently from the notification which do not contain this field.?
Any references to documentation or example implementation which makes use of this field is highly appreciated.
Thanks in advance.
Will the field "delivery_receipt_requested" be sent to the app or the connection server itself will consume it.?
The FCM client installed in Google Play services will handle this.
The application will not notice anything different.
If the app receives this field in a notification will it need to act differently from the notification which do not contain this field.?
The application doesn't need to take any action. indeed the app will not receive this field.
Longer explanation:
delivery_receipt is not exactly a confirmation that the app received the message, but it's a confirmation that the device received the message. To be clear it's still possible that the device crashed or run out of battery while the message is being passed to the app.
this feature is implemented outside of the application. so the application doesn't need to be aware that this message requires a delivery receipt
you can implement a more precise "application delivery receipt" by calling your backend in the method that receives the message.
(like an http call to: http://mywebsite.com/confirm-msg-processed-successfully.php?id=133)
I have implemented GCM push notification in my app. It's working fine. In some scenarios, notification should be received immediately, but I receive it very late. Is there anyway to check whether I have notification in my GCM Queue ?
Note:
I understand that, Push notification mechanism is completely to overcome Polling mechanism. But curious to know whether the above thing is possible or not ?
The Google Cloud Messaging server returns a response for each message you send to it. That message tells you whether the message was accepted or rejected by the server (it doesn't tell whether it was actually delivered to the device) and also specifies the type of error if any.
You may check the Offical Google Cloud Messaging documentation: https://developers.google.com/cloud-messaging/#receipts
I'm trying to follow the official guide for setting up a GCM client.
The Situation
After having set up everything just like in the guide,
I am able to send a message over to the GCM, using:
gcm.send
Then, exactly as should happen, the broadcaster calls to my intent's OnReceived procedure.
So far so good.
The Problem
Upon receiving the actual data, meaning - the intent's extras as a Bundle object, a problem occurs.
The extras' content (toString) contains an error:
Bundle[{error=TooManyMessages,
message_type=send_error,
google.message_id=1,
android.support.content.wakelockid=1}
The Meaning
Now, I've done my research, but came up with no practical answers. Only an explanation as to what is happening. Here is the problem, and its explanation:
This means that too many messages were stored in the GCM server for a single device without being delivered (which might happen if your device was offline while many messages were sent by your server).
Once the number of such messages reaches the limit, which is 100 if you don't use a collapse key, they are deleted from the GCM server, and you get that error message, which informes you your device should sync with your server in order to get the lost messages.
The Question
So, according to the answer, I am to sync my device with the server. How, exactly?
Also note, I have not created a GCM server. I'm only using the official GCM client implementation.
Thanks in advance to those who help!
-P
It's unclear what you are trying to send and to whom. The gcm.send method sends a message from your application to your server. For the message to big delivered, you must implement a server that connects to the GCM Cloud Connection Server. Since you don't have a server, GCM can't send the message to your server, and stores the message. Once too many messages are stored, you get the TooManyMessages error.
You must implement a server in order to use GCM. If you only want to send messages from the server to your app, you can use the simpler GCM HTTP API. If you need to send messages from your app to your server, you should use the GCM CCS API.
The answer you are referring to describes a different situation in which you can get TooManyMessages error (when the server sends many messages to the same device, but GCM can't deliver those messages), but it's not relevant to your situation.
As far I as know, upon successful posting a notification to GCM Server, it will return a status code of 200 and a response as such id=1:2342.
However, according to their documentation, this does not guarantee successful delivery to the device. Just a successful status of delivering the notification to the GCM server.
So my question is, is there a way for me to know that the notification has been sent to the phone successfully? Is there a Delivery Notification returned by GCM to my side upon successful delivery? If not, does any of you guys have any ideas on keeping track of those?
Thanks.
GCM does not notify your server when the message is sent to the phone.
If you require that functionality, you'll have to implement it yourself. You can attach a message identifier field to the GCM message. When the message arrives to the phone, your app will send that message identifier back to your server (using an HTTP request), to acknowledge that it received the message.