سؤال

How can some service-style (long running) android apps be reachable over network although they do no polling from a server?

The info on Theis Borg's app Android Lost says:

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 )

I would like to find out how to write such apps.

(For broader audience, I've also posted this question on android.stackexchange.com)

هل كانت مفيدة؟

المحلول

Google Cloud Messaging (GCM) provides this functionality. 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; 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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top