Fetching analytics related to push notification in `FCM Cloud Messaging` - android

I want to know whether push notifications are delivered to all the registrationId mapped to my user database or not.
I have 8000 users and all are having registrationId. I had sent notification to all of them and now i want to determine whether all those user had received the notification or not.
so is there any way to access this analytics using some FCM url.
I am aware that i can see analytics in google publisher from STATISTICS menu and selecting FCM messages and to check the delivery status i can go to FCM Diagnostics
Firebase support page
but using that tool to determine 8k users is nearly impossible so how can i get the analytics of cloud messaging.
Long back i have seen some link but forgot to bookmark :(

There is currently no API to retrieve the delivery status for sent FCM messages.
In general, when the FCM server successfully receives the payload you've sent from your App Server, it should return a success:1 response along with a message_id.
If what you're aiming for is to know if the device has successfully received the message, you should implement Delivery Receipts:
Delivery Receipt: If the app server included delivery_receipt_requested in the downstream message, the XMPP connection server sends a delivery receipt when it receives confirmation that the device received the message.

Related

FCM: Access all sent push messages

The goal I want to achieve for the app owner is to send FCM push notifications via web interface to the customers (already achieved) and to give the customers a view in my app, on which they can read all or at least the last 10 sent push messages. Is there any (REST) api in FCM which can be used to receive the sent push notifications and its content so I can display them in my Android fragment?
Unfortunately, there is no available API as of the moment to retrieve your GCM/FCM logs. However, there's been a recent improvement in the Firebase Notifications console where stats for messages sent using the FCM API is included in the Firebase Notification console stats.
The more details can be found from this answer and the blogpost.

Sending a push notification to a user in the database

I am trying to implement push notification using Firebase Cloud Messaging but it seems as if you have to register the device to receive push notifications. I am trying to make it so when there is action in the database, such as an inbox reply, send a push notification to the user who received the message.
Is there a way to send the push notification with Firebase to a particular user, not a particular device?
You don't send push notifications to a user, you send them to a device.
Somewhere in your code (maybe when your user signs up/ logs in to your app), you have to execute the code to get a GCM registration token. This token is unique to your Android app and that specific Android device.
With that token, you can send push notifications to that device using any method you want (from an app, from a website, etc. If you have a GCM reg token you can even send pushes from this handy website: http://1-dot-sigma-freedom-752.appspot.com/).
It is now your responsibility to keep a database of your users and their GCM registration tokens. When a user wants to send a push to another user, you would find the corresponding registration token in your database and then execute the code to send them the push using that token.
FCM provides several ways for you to send notifications to your users. You can send messages directly to devices via an Instance ID token, you can send messages to a topic that your user has subscribed to, and you can also send messages to groups of users eg: country/language etc.
Have a look at this sample which demonstrates sending to a device and topic. Also have a look at the docs for more details on sending and receiving messages.

User to user messaging on Google Cloud Messaging

I have setup Google Cloud Messaging on Google App Engine. I have successfully managed to implement downstream messaging to an Android client.
I have the following questions regarding the usage of GCM:
Does it allow user to user messaging?
Where can I check the delivery status of upstream messages?
If user to user is not possible, what's the solution to setup a basic chat between users using GCM?
You can consider this implementation to work with GCM
Device A ------> Your Server ------> GCM Server ------> Device B
Device B ------> Your Server ------> GCM Server ------> Device A
1. Does it allow user to user messaging?
To create a user to user messaging, you can use device to send a request to the GCM server and vice-versa for the corresponding device as illustrated above.
2. Where can I check the delivery status of upstream messages?
I refer the delivery status of the upstream message as the recipient getting a message on his device. When the recipient receives his message, you can send an acknowledge back to your server to indicate the success.
Alternatively, you can also check the status of your message being sent to your server and the GCM server if you wish to simplify the process.
Hope this helps!

GCM Message Delivery Confirmation

I am implementing push notifications with Google Cloud Messaging. I am simply testing with their demo applicaitons on official site.
All is working well.
But, has anyone idea of how to gurantee the delivery of message, in anyway?
Or can we invoke server to let know once the message are delivered in device, and will it be reliable approach?
Take a look at the answer on Android GCM delivery monitoring.
"They don't guarantee delivery but they try for a max of 4 weeks to deliver the message depending on the duration you set in the message you send to Google's GCM servers and if you wish to let Google keep the data for eventual delivery of msg to the device in case the device was offline when the message was to be delivered."
Google has added support so that you can receive delivery receipts from Cloud Connection Server (CCS):
You can use upstream messaging to get delivery receipts (sent from CCS to your 3rd party app server) when a device confirms that it received a message sent by CCS.
To enable this feature, the message your 3rd-party app server sends to CCS must include a field called "delivery_receipt_requested". When this field is set to true, CCS sends a delivery receipt when a device confirms that it received a particular message.
https://developers.google.com/cloud-messaging/ccs#receipts

Android GCM delivery monitoring

I am developing mobile client for emailing service. One of the key features is notifications about new messages in the mailbox. As recommended by GCM architecture guidelines we are using a "Pusher" that is responsible for sending messages to the Google servers once we received a new message. The issue is that testing process has reported about serious problems with push notification delivery to devices.
So the question: is there an approaches for monitoring average statistics about push notification delivery percentage, time etc? Or maybe somebody have experience in how to set up test environment for efficient monitoring of how much notifications are getting lost during the application work?
All the "tips&tricks" related to the improving Android GCM experience are welcome.
Google claims that the processing at their GCM server takes less than a millisecond. Link below for a great video on GCM from Google's developer. And it's believable coz I could get push notifications almost instantaneously using my company's server to my device now.
http://www.youtube.com/watch?v=YoaP6hcDctM
They don't guarantee delivery, but they try for a max of 4 weeks to deliver the message depending on the duration you set in the message you send to Google's GCM servers and if you wish to let Google keep the data for eventual delivery of message to the device in case the device was offline when the message was to be delivered.
However, there are certain conditions under which the GCM messages are not delivered.
Background data is unchecked under Account and Sync settings.
Prior to 4.0.4.(ICS), a Google account on the device is a pre-requisite for GCM. Maybe, Users are not logged into their Google account.
The only way to do so is to report back to your server with the timestamp of the received push.
You can either
Report back to the server once you receive the notification in your GCM service. To implement, you will have to add a push id for your push notifications and send the id along with the push data. The client will have to get the timestamp once it receive the message and send it back along with the notification id. A simple php script can be done (when you send a push notification, you set the time of the send-notification and once it receives the device's timestamp it sets the receive-notification. This boils down to two fields in your database (marked in bold). In this approach you will probably not so much care about errors since it is very probable that the device will have a connection when it receives the notification and as such its request to your server will go through.
Keep a list of notifications received in your app and their timestamps. And when the sync is done, send the this data in your sync operation. This is ultimately the same approach but your server's data won't be as realtime as the first approach. However, the extra request is not required from the client's side but saving the received notifications and their timestamps is.
All in all, you will have to keep track of the notifications sent using a notification-id and their sending time (send-notification) and their receive time (receive-notification). A simple query will help you analyze this data.
Google has added support so that you can receive delivery receipts from Cloud Connection Server (CCS):
You can use upstream messaging to get delivery receipts (sent from CCS to your 3rd party app server) when a device confirms that it received a message sent by CCS.
To enable this feature, the message your 3rd-party app server sends to CCS must include a field called "delivery_receipt_requested". When this field is set to true, CCS sends a delivery receipt when a device confirms that it received a particular message.
https://developer.android.com/google/gcm/ccs.html#receipts
Google does not make these statistics available to you. There are some statistics available on the android developer console. This only shows the number of messages and registrations.
You would have to implement your own data collection, which could be done fairly easily. You could record the time & id of each message sent and have your android client report back to your server with the time of message receipt. You could then store the data on your server and query as needed.
Since that time Google has provided developers with advanced monitoring tool.
The Gcm Diagnostic Tool is available in Google Play developer console. Additional information is here https://support.google.com/googleplay/android-developer/answer/2663268
So you can easily track the particular message status via registration token.

Categories

Resources