I have started integrating GCM to my android application. With the help of startup tutorial I have setup the sample demo and it works fantastic. I also understood the different response statuses received when my server sends the message to GCM, which I believe signifies the status of the communication between my server and GCM server.
My question is, is there a a way to get the status of the communication between GCM server and android application? Basically an acknowledgement signifying whether intended message has been successfully delivered or not. I also read that, the default timeout is 4 weeks, unless the time_to_live flag is set, which enables my understanding that GCM maintains the queue and would definitely ensure the message delivery.
However, to ensure the reliability, as third party server, should I ever need to retry sending the same message (if it's not already taken care by the GCM infrastructure)? if I need to take care of the retry, how to determine the failure?
One way I have is, to define a push id and send it along with the message, once it is received the android app will report the server with the respective push id. If the response not received within a specified time, then, the server will retry sending the message. This approach is defined in the 2nd answer of the post and will help monitoring the time taken by the GCM (specially for the QA team).
Google Cloud Messaging (GCM) was a mobile notification service developed by Google that enables third-party application developers to send notification data or information from developer-run servers to applications that target the Google Android Operating System, as well as applications or extensions developed for the ...
Use web socket. My application's one time usage expectation is ~2 minutes. So web socket looks like a good choice, because app will be terminated or go to background state quickly and battery consume won't be much. Also all the server side data changes will come to the device just in time.
another option is Gotify. Gotify is self-hosted open source notification solution that you can use it to send push notification to your android app without need of Firebase. with help of UnifiedPush you can receive push notifications in your android app.
I do not believe that it is possible to get that information from the GCM servers. This means that you will have to rely on another method of communication (as you described) between the client apps that successfully receive your message and your server.
The response you get from the GCM servers (as you know) simply lets you know either:
success: Number of messages that were processed without an error.
or
failure: Number of messages that could not be processed.
Meaning that you can know which registration Ids were processed properly (e.g. valid values, still registered with GCM), but not whether or not the messages were successfully delivered down to the actual device.
According to Google's GCM documentation.... this may be helpful:
http://developer.android.com/google/gcm/ccs.html#receipts
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With