[英]How to make an android app reachable without repreatedly polling from a server?
How can some service-style (long running) android apps be reachable over network although they do no polling from a server? 尽管服务风格(长期运行)的Android应用程序不从服务器轮询,但如何通过网络访问呢?
The info on Theis Borg's app Android Lost says: Theis Borg应用程序Android Lost上的信息说:
The app does no polling to a server, so there is no extra battery usage. 该应用程序不轮询服务器,因此没有多余的电池使用量。
( https://play.google.com/store/apps/details?id=com.androidlost&hl=en ) ( https://play.google.com/store/apps/details?id=com.androidlost&hl=zh_CN )
I would like to find out how to write such apps. 我想了解如何编写此类应用程序。
(For broader audience, I've also posted this question on android.stackexchange.com ) (对于更广泛的受众,我还将这个问题发布在android.stackexchange.com上 )
Google Cloud Messaging (GCM) provides this functionality. Google Cloud Messaging(GCM)提供了此功能。 The Google Services Framework app (preinstalled on most Android devices) connects to Google servers and keeps that connection as long as the Android device has Internet connectivity; Google Services Framework应用程序(大多数Android设备上已预装)连接到Google服务器,并在Android设备具有Internet连接时保持该连接; this single connection is used to receive incoming GCM messages for all installed apps which use GCM, and the app which handles the message is started on demand — so it does not even need to be running in the background. 这个单一连接用于接收所有已安装的使用GCM的应用程序的传入GCM消息,并且处理该消息的应用程序是按需启动的,因此它甚至不需要在后台运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.