From 6b372626e90f87441087397b515eebb1bd631cfe Mon Sep 17 00:00:00 2001 From: Katie McCormick Date: Fri, 15 Nov 2013 16:02:58 -0800 Subject: [PATCH] Doc update: redo of new API Console steps. Fixes for: b/11713745 b/11712882 b/10669388 b/10641901 Change-Id: I071eba31d51f0e29b9be4a7f7ede0f01c7a52838 --- docs/html/google/gcm/adv.jd | 14 +++---- docs/html/google/gcm/client.jd | 22 +++++----- docs/html/google/gcm/gcm.jd | 4 +- docs/html/google/gcm/gs.jd | 73 ++++++++++++++-------------------- docs/html/google/gcm/server.jd | 4 +- 5 files changed, 51 insertions(+), 66 deletions(-) diff --git a/docs/html/google/gcm/adv.jd b/docs/html/google/gcm/adv.jd index 567b12cbb60c1..245467f51f185 100644 --- a/docs/html/google/gcm/adv.jd +++ b/docs/html/google/gcm/adv.jd @@ -96,7 +96,7 @@ invalidate the registration ID. Future attempts to send a message to that device will get a NotRegistered error. See How Unregistration Works for more information.

Although is not possible to track the status of each individual message, the -Google APIs Console stats are broken down by messages sent to device, messages +Google Cloud Console stats are broken down by messages sent to device, messages collapsed, and messages waiting for delivery.

Throttling

@@ -312,14 +312,10 @@ individually. Note that the order of delivery is not guaranteed.

GCM will store up to 100 non-collapsible messages. After that, all messages are discarded from GCM, and a new message is created that tells the client how far behind it is. The message is delivered through a regular -com.google.android.c2dm.intent.RECEIVE intent, with the following -extras:

- +com.google.android.c2dm.intent.RECEIVE intent with the +extra message_type, for which the value is always the string +"deleted_messages".

+

The application should respond by syncing with the server to recover the discarded messages.

diff --git a/docs/html/google/gcm/client.jd b/docs/html/google/gcm/client.jd index df357a2703090..ee764ef2df871 100644 --- a/docs/html/google/gcm/client.jd +++ b/docs/html/google/gcm/client.jd @@ -416,15 +416,18 @@ private void registerInBackground() { } }.execute(null, null, null); ... - /** - * Sends the registration ID to your server over HTTP, so it can use GCM/HTTP - * or CCS to send messages to your app. Not needed for this demo since the - * device sends upstream messages to a server that echoes back the message - * using the 'from' address in the message. - */ - private void sendRegistrationIdToBackend() { - // Your implementation here. - } +} + +

Once you've received your registration ID, send it to your server:

+
+/**
+ * Sends the registration ID to your server over HTTP, so it can use GCM/HTTP
+ * or CCS to send messages to your app. Not needed for this demo since the
+ * device sends upstream messages to a server that echoes back the message
+ * using the 'from' address in the message.
+ */
+private void sendRegistrationIdToBackend() {
+    // Your implementation here.
 }

After registering, the app calls {@code storeRegistrationId()} to store the @@ -660,4 +663,3 @@ want to view GCM stats.

Note: Stats on the Google API Console are not enabled for GCM. You must use the Developer Console.

- diff --git a/docs/html/google/gcm/gcm.jd b/docs/html/google/gcm/gcm.jd index 3c80b5f9ae5f1..88bf6591f34eb 100644 --- a/docs/html/google/gcm/gcm.jd +++ b/docs/html/google/gcm/gcm.jd @@ -104,7 +104,7 @@ application server and sending them to the device. Credentials - Sender ID + Sender ID A project number you acquire from the API console, as described in Getting Started. The sender ID is used in the registration process to identify a @@ -140,7 +140,7 @@ which would cause delivery errors. account if the device is running a version lower than Android 4.0.4. - Sender Auth Token + Sender Auth Token An API key that is saved on the 3rd-party application server that gives the application server authorized access to Google services. The API key is included in the header of POST requests that send messages. diff --git a/docs/html/google/gcm/gs.jd b/docs/html/google/gcm/gs.jd index f6b7ebe8244b1..2a2c1c912b0c9 100644 --- a/docs/html/google/gcm/gs.jd +++ b/docs/html/google/gcm/gs.jd @@ -18,7 +18,8 @@ page.tags="cloud","push","messaging"

See Also

    -
  1. Google APIs Console page
  2. +
  3. Google Cloud Console
  4. +
  5. Google Cloud Console Help
  6. CCS and User Notifications Signup Form
@@ -32,66 +33,53 @@ the Google Play Services SDK. You need this SDK to use the {@code GoogleCloudMessaging} methods.

-

Creating a Google API project

To create a Google API project:

    -
  1. Open the Google APIs Console page. +
  2. Open the Google Cloud Console.
  3. -
  4. If you haven't created an API project yet, this page will prompt you to do so: -

    -

    Note: If you already have existing projects, -the first page you see will be the Dashboard page. From there -you can create a new project by opening the project drop-down menu (upper left corner) -and choosing Other projects > Create.

  5. -
  6. Click Create project. - Your browser URL will change to something like:
  7. +
  8. If you haven't created an API project yet, click Create Project.
  9. -
     https://code.google.com/apis/console/#project:4815162342
    +
  10. Supply a project name and click Create. -
  11. Take note of the value after #project: (4815162342 in this -example). This is your project number, and it will be used later on as the GCM sender ID.
  12. +

    Once the project has been created, a page appears that displays your project ID and +project number. For example, Project Number: 670330094152.

    + +
  13. Copy down your project number. You will use it later on as the + GCM sender ID.

Enabling the GCM Service

To enable the GCM service:

    -
  1. In the main Google APIs Console page, select Services.
  2. -
  3. Turn the Google Cloud Messaging toggle to ON.
  4. -
  5. In the Terms of Service page, accept the terms. -
  6. +
  7. In the sidebar on the left, select APIs & auth.
  8. +
  9. In the displayed list of APIs, turn the Google Cloud Messaging for Android + toggle to ON.
  10. +

Obtaining an API Key

To obtain an API key:

    -
  1. In the main Google APIs Console page, select API Access. -You will see a screen that resembles the following:
  2. +
  3. In the sidebar on the left, select APIs & auth > Registered apps.
  4. +
  5. Click Register app.
  6. +
  7. In the Name field, type your app's name.
  8. +
  9. Click Android > Accessing APIs directly from Android.
  10. +
  11. Under Android identification, type the package name for your app.
  12. +
  13. Enter an SHA1 fingerprint. To get this value, follow the instructions in the +console +help.
  14. +
  15. Click Register.
  16. - +
  17. In the new page, open the Android Key section and copy the +API key. +You will need the API key later on to perform authentication in your application server.
  18. -
  19. Click Create new Server key. Either a server key or a -browser key should work. The advantage to using a server key is that it allows -you to whitelist IP addresses. The following screen appears:
  20. - - - - - -
  21. Click Create:
  22. - - - - - - -
-

Take note of the API key value (YourKeyWillBeShownHere) -in this example, as it will be used later on.

Note: If you need to rotate the key, click -Generate new key. A new key will be created while the old one -will still be active for up to 24 hours. If you want to get rid of the old key -immediately (for example, if you feel it was compromised), click Delete key.

+the "recycle key" icon. A new key will be created. If you think the key has been compromised +and you want to delete it immediately, you can accomplish this by deleting the app from +the console. Then create a new entry for the app with the same SHA1 and package name.

+

Next Steps

@@ -113,4 +101,3 @@ Implementing GCM Server. on a device. See Implementing GCM Client for more information. - diff --git a/docs/html/google/gcm/server.jd b/docs/html/google/gcm/server.jd index b5e6b480d057a..7ba1bd535945c 100644 --- a/docs/html/google/gcm/server.jd +++ b/docs/html/google/gcm/server.jd @@ -134,7 +134,7 @@ server sends a message:

  • When the device is online, Google sends the message to the device.
  • On the device, the system broadcasts the message to the specified Android application via Intent broadcast with proper permissions, so that only the targeted -ndroid application gets the message. This wakes the Android application up. +Android application gets the message. This wakes the Android application up. The Android application does not need to be running beforehand to receive the message.
  • The Android application processes the message.
  • @@ -146,7 +146,7 @@ sending messages.

    Required. When your app server sends a message in GCM, it must specify a target.

    For HTTP you must specify the target as one of: