如何在Android上做推送通知技术的工作原理? [英] How does push notification technology work on Android?

查看:181
本文介绍了如何在Android上做推送通知技术的工作原理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是如何实现谷歌的推送通知功能?它的工作原理,通过投票通过一项服务在后台运行,或以不同的方式做?

How has Google implemented their push notification feature? Does it work through polling done by a service running in the background or in a different way?

推荐答案

从我在以色列的Andr​​oid开发者会议上听说过:

From what I've heard during an Android developers conference in Israel:

有一个简单的TCP套接字等待<一href="http://publib.boulder.ibm.com/infocenter/tpfhelp/current/index.jsp?topic=%2Fcom.ibm.ztpf-ztpfdf.doc_put.cur%2Fgtps5%2Fs5tcpcf.html">accept模式云谷歌的服务器上。 TCP连接已经发起的护目Play应用程序。这就是为什么谷歌播放必须在设备上安装了用于制作谷歌云消息(GCM)(以前的Andr​​oid云到设备消息服务 - C2DM )工作

There is simply a TCP socket waiting in accept mode on a cloud Google server. The TCP connection had been initiated by the Goggle Play application. That's why Google Play must be installed on the device for making Google Cloud Messaging (GCM) (formerly Android Cloud to Device Messaging Service - C2DM) work.

在此TCP客户端套接字收到一些邮件,邮件中包含的信息,如应该给应用程序的包名,当然 - 数据本身。这些数据进行分析,并打包成广播,并最终由应用程序接收到意图

When this TCP client socket receives some message, the message contains information such as the package name of the application it should be addressed to, and of course - the data itself. This data is parsed and packed into an intent that is broadcast and eventually received by the application.

TCP套接字即使设备的无线状态变为空闲模式保持打开状态。应用程序不必运行以接收意图

The TCP socket stays open even when the device's radio state turns into "idle" mode. Applications don't have to be running to receive the intents.

在<一个更多信息href="http://developer.android.com/google/gcm/gcm.html">http://developer.android.com/google/gcm/gcm.html

这篇关于如何在Android上做推送通知技术的工作原理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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