一旦预期的消息被传送到android应用程序,我的服务器能否从GCM接收到确认? [英] Can my server receive the acknowledgement from the GCM once the intended message is delivered to the android app?

查看:77
本文介绍了一旦预期的消息被传送到android应用程序,我的服务器能否从GCM接收到确认?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始将GCM集成到我的android应用程序中。在启动教程的帮助下,我已经设置了示例演示,并且它的工作原理非常棒。我还了解当我的服务器发送消息时收到的不同的响应状态到GCM,我相信这表示我的服务器和GCM服务器之间的通信状态。

我的问题是,有没有办法获得GCM服务器和android应用程序之间的通信状态?基本上是表示预期消息是否已成功传递的确认。我还了解到,默认超时为4周,除非time_to_live标志这使我的理解是,GCM维护队列,并且肯定会确保消息传递。然而,为了确保作为第三方服务器的可靠性,我应该永远需要重试发送相同的消息(如果它尚未由GCM基础设施保管)?如果我需要照顾重试,如何确定失败?



我的一个方法是,定义一个推送id并将其与消息一起发送,一旦收到android应用程序将用相应的推送ID报告服务器。如果在指定时间内未收到响应,则服务器将重试发送该消息。此方法在帖子的第二个答案中定义,并将帮助监控GCM(特别针对QA团队)。

解决方案

我不相信可以从GCM服务器获取该信息。这意味着您将不得不依赖于成功接收您的消息的客户端应用程序和您的服务器之间的另一种通信方式(如您所述)。



您得到的响应从GCM服务器(如您所知)只需让知道

 成功:处理时没有错误的消息数量。 

 失败:无法处理的消息数。 

这意味着您可以知道哪些注册ID已被正确处理(例如仍然在GCM中注册的有效值) ,而不是消息是否成功传递到实际设备。


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

解决方案

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.

这篇关于一旦预期的消息被传送到android应用程序,我的服务器能否从GCM接收到确认?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆