From de53b041c13e23422e8dd236905a8765a06c05dd Mon Sep 17 00:00:00 2001 From: kmccormick Date: Mon, 10 Nov 2014 14:03:01 -0800 Subject: [PATCH] Doc update: new reg error code + snippet Change-Id: Ie8df1cc68ebe5a2a6589d34f16e554e36dca546e --- docs/html/google/gcm/ccs.jd | 18 ++++++++++++++++-- docs/html/google/gcm/client.jd | 15 +++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/docs/html/google/gcm/ccs.jd b/docs/html/google/gcm/ccs.jd index 7db7a74c8abfa..6332b8d9b1d76 100644 --- a/docs/html/google/gcm/ccs.jd +++ b/docs/html/google/gcm/ccs.jd @@ -263,6 +263,21 @@ message is "nack". A NACK message contains:

</message> +

Device Message Rate Exceeded:

+ +
<message id="...">
+  <gcm xmlns="google:mobile:data">
+  {
+    "message_type":"nack",
+    "message_id":"msgId1",
+    "from":"REGID",
+    "error":"DEVICE_MESSAGE_RATE_EXCEEDED",
+    "error_description":"Downstream message rate exceeded for this registration id"
+  }
+  </gcm>
+</message>
+
+

The following table lists NACK error codes. Unless otherwise indicated, a NACKed message should not be retried. Unexpected NACK error codes should be treated the same as {@code INTERNAL_SERVER_ERROR}.

@@ -303,8 +318,7 @@ message should be immediately retried over another connection. {@code DEVICE_MESSAGE_RATE_EXCEEDED} The rate of messages to a particular device is too high. You should reduce the number of messages sent to this device and should not immediately retry -sending to this device. This error code replaces {@code QUOTA_EXCEEDED}, -which has been deprecated. +sending to this device. This error code is replacing {@code QUOTA_EXCEEDED}. {@code SERVICE_UNAVAILABLE} diff --git a/docs/html/google/gcm/client.jd b/docs/html/google/gcm/client.jd index 70109c6f39dbc..d44ee3c6717c3 100644 --- a/docs/html/google/gcm/client.jd +++ b/docs/html/google/gcm/client.jd @@ -452,6 +452,21 @@ private void storeRegistrationId(Context context, String regId) { editor.commit(); } +

Handle registration errors

+ +

As stated above, an Android app must register with GCM servers and get a registration ID +(regID) before it can receive messages. A given regID is not guaranteed to last indefinitely, +so the first thing your app should always do is check to make sure it has a valid regID +(as shown in the code snippets above).

+ +

In addition to confirming that it has a valid regID, your app should be prepared to handle +the registration error {@code TOO_MANY_REGISTRATIONS}. This error indicates that the device +has too many apps registered with GCM. The error only occurs in cases where there are +extreme numbers of apps, so it should not affect the average user. The remedy is to prompt +the user to delete some of the other GCM-enabled apps from the device to make +room for the new one.

+ +

Send a message

When the user clicks the app's Send button, the app sends an upstream message using the