[This place is by Dave Burke, who's an Engineering Manager 80% of the time. Tim Bray]
Android Cloud to Device Messaging (C2DM) was launched recently as conception of Android 2.2. C2DM enables third-party developers to near lightweight accumulation messages to the phone. C2DM created a pleasant possibleness for us to vantage together assorted Google developer tools to create a ultimate but multipurpose covering to enable users to near course and other information from their desktop / laptop to their phone. The result was Chrome to Phone - a 20-percent instance project at Google.
Chrome to Phone comprises a Chrome Extension, an Android Application, and a Google AppEngine server. All of the cipher is open sourced and serves as a pleasant warning of how to ingest C2DM.
The communication line in Chrome to Phone is fairly exemplary of a near service:
The Android Application registers with the C2DM assist and gets a figure entrance ID for the user. It sends this entrance ID along with the user's statement study to the AppEngine server.
The AppEngine computer authenticates the individual statement and stores the function from statement study to figure entrance ID.
The Chrome Extension accesses the address and tender denomination for the current tab, and POSTs it to the AppEngine server.
The AppEngine computer authenticates the individual and looks up the same figure entrance ID for the individual statement name. It then HTTP POSTs the address and denomination to Google's C2DM servers, which afterward route the communication to the device, resulting in an Intent broadcast.
The Android covering is woken by its Intent receiver. The Android covering then routes the address to the appropriate covering via a new Intent (e.g. browser, dialer, or Google Maps).
An engrossing organisation choice in this covering was to send the explosive (URL and title) as conception of the near message. A hash of the address is utilised as a collapse_key to preclude binary button presses resulting in duplicate intents. In generalisation the full address could have been used, but the hash is shorter and avoids unnecessarily exposing explosive data. An deciding approach (and indeed the preferred one for larger payloads) is to ingest the near communication assist as a tickle to wake up the application, which would afterward bring the explosive out-of-band, e.g. over HTTP.
The cipher for Chrome to Phone is online. Both the AppEngine and Android Application allow a reusable package called com.google.android.c2dm that handles the lower-level C2DM interactions (e.g. configuration, task queues for resilience, etc).
Chrome to Phone is useful, but maybe its most engrossing as an warning of how to ingest Android C2DM.
Tidak ada komentar:
Posting Komentar