From eb1e7eac9f0e1e8ac68da736b9ed92c9729ede08 Mon Sep 17 00:00:00 2001
From: && repo sync -j8 GCM allows multiple parties to send messages to the same application. For example, suppose your application is an articles aggregator with multiple contributors, and you want each of them to be able to send a message when they publish a new article. This message might contain a URL so that the application can download the article. Instead of having to centralize all sending activity in one location, GCM gives you the ability to let each of these contributors send its own messages. To make this possible, all you need to do is have each sender generate its own project ID. Then include those IDs in the sender field, separated by commas, when requesting a registration. Finally, share the registration ID with your partners, and they'll be able to send messages to your application using their own authentication keys. To make this possible, all you need to do is have each sender generate its own project number. Then include those IDs in the sender field, separated by commas, when requesting a registration. Finally, share the registration ID with your partners, and they'll be able to send messages to your application using their own authentication keys. This code snippet illustrates this feature. Senders are passed as an intent extra in a comma-separated list: C2DM and GCM are not interoperable. For example, you cannot post notifications from GCM to C2DM registration IDs, nor can you use C2DM registration IDs as GCM registration IDs. From your server-side application, you must keep keep track of whether a registration ID is from C2DM or GCM and use the proper endpoint. As you transition from C2DM to GCM, your server needs to be aware of whether a given registration ID
-contains an old C2DM sender or a new GCM project ID. This is the approach we recommend: have the new app version (the one that uses GCM) send a bit along with the registration ID. This bit tells your server that this registration ID is for GCM. If you don't get the extra bit, you mark the registration ID as C2DM. Once no more valid registration IDs are marked as C2DM, you can complete the migration.Receiving Messages from Multiple Senders
Intent intent = new Intent(GCMConstants.INTENT_TO_GCM_REGISTRATION);
intent.setPackage(GSF_PACKAGE);
diff --git a/docs/html/guide/google/gcm/c2dm.jd b/docs/html/guide/google/gcm/c2dm.jd
index ecc08c1..e80a41f 100644
--- a/docs/html/guide/google/gcm/c2dm.jd
+++ b/docs/html/guide/google/gcm/c2dm.jd
@@ -55,7 +55,7 @@ page.title=Migration
This section describes how to move existing C2DM apps to GCM.
Migration is simple! The only change required in the application is replacing the email account passed in the sender parameter of the registration intent with the project ID generated when signing up for the new service. For example:
+Migration is simple! The only change required in the application is replacing the email account passed in the sender parameter of the registration intent with the project number generated when signing up for the new service. For example:
Intent registrationIntent = new Intent("com.google.android.c2dm.intent.REGISTER");
// sets the app name in the intent
registrationIntent.putExtra("app", PendingIntent.getBroadcast(this, 0, new Intent(), 0));
diff --git a/docs/html/guide/google/gcm/demo.jd b/docs/html/guide/google/gcm/demo.jd
index d66cbbc..7e35fd6 100644
--- a/docs/html/guide/google/gcm/demo.jd
+++ b/docs/html/guide/google/gcm/demo.jd
@@ -62,7 +62,7 @@ page.title=GCM Demo Application
For the Android application:
Before proceeding with the server and client setup, it's necessary to register a Google account with the Google API Console, enable Google Cloud Messaging in GCM, and obtain an API key from the Google API Console.
@@ -175,7 +175,7 @@ runserver:static final String SERVER_URL = "http://192.168.1.10:8080/gcm-demo"; static final String SENDER_ID = "4815162342";-
Note that the SERVER_URL is the URL for the server and the application's context (or just server, if you are using App Engine), and it does not include the forward slash (/). Also note that SENDER_ID is the Google API project ID you obtained in the server setup steps above.
Note that the SERVER_URL is the URL for the server and the application's context (or just server, if you are using App Engine), and it does not include the forward slash (/). Also note that SENDER_ID is the Google API project number you obtained in the server setup steps above.
gcm-demo-client directory.android tool to generate the ant build files:sender is the project ID of the account authorized to send messages
+ sender is the project number of the account authorized to send messages
to the Android application. app is the Android application's ID, set with a PendingIntent to
allow the registration service to extract Android application information. false, and must be a JSON bool
time_to_livecategorydry_runfalse, and must be a JSON boolean.
+ If you are using plain text instead of JSON, the message fields must be set as HTTP parameters sent in the body, and their syntax is slightly different, as described below:
@@ -696,9 +706,19 @@ sent. Optional. The default value is false, and must be a JSON bool
time_to_livecategorydry_runIf you want to test your request (either JSON or plain text) without delivering the message to the devices, you can set an optional HTTP parameter called dry_run with the value true. The result will be almost identical to running the request without this parameter, except that the message will not be delivered to the devices. Consequently, the response will contain fake IDs for the message and multicast fields (see Response format).
If you want to test your request (either JSON or plain text) without delivering the message to the devices, you can set an optional HTTP or JSON parameter called dry_run with the value true. The result will be almost identical to running the request without this parameter, except that the message will not be delivered to the devices. Consequently, the response will contain fake IDs for the message and multicast fields (see Response format).
Here is the smallest possible request (a message without any parameters and just one recipient) using JSON:
@@ -879,7 +899,7 @@ Happens when the error code isInvalidDataKey.
error field o
object in the results array is InternalServerError.
InvalidCategory.
+https://code.google.com/apis/console/#project:4815162342-
#project: (4815162342 in this example). This is your project ID, and it will be used later on as the GCM sender ID.#project: (4815162342 in this example). This is your project number, and it will be used later on as the GCM sender ID.