Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can my server receive the acknowledgement from the GCM once the intended message is delivered to the android app?

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).

like image 875
Mukesh Bhojwani Avatar asked Jan 03 '13 09:01

Mukesh Bhojwani


People also ask

What is GCM notification?

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 ...

What is the best way for a server to notify an app that some new data is available?

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.

How do I send notifications to server on Android without firebase?

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.


2 Answers

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.

like image 130
selsine Avatar answered Nov 05 '22 12:11

selsine


According to Google's GCM documentation.... this may be helpful:

http://developer.android.com/google/gcm/ccs.html#receipts

like image 38
SkyNet801 Avatar answered Nov 05 '22 13:11

SkyNet801