summaryrefslogtreecommitdiffstats
path: root/docs/html/guide/google
diff options
context:
space:
mode:
Diffstat (limited to 'docs/html/guide/google')
-rw-r--r--docs/html/guide/google/gcm/adv.jd2
-rw-r--r--docs/html/guide/google/gcm/c2dm.jd6
-rw-r--r--docs/html/guide/google/gcm/demo.jd4
-rw-r--r--docs/html/guide/google/gcm/gcm.jd36
-rw-r--r--docs/html/guide/google/gcm/gs.jd2
-rw-r--r--docs/html/guide/google/play/expansion-files.jd31
6 files changed, 54 insertions, 27 deletions
diff --git a/docs/html/guide/google/gcm/adv.jd b/docs/html/guide/google/gcm/adv.jd
index 356ee1d..1360624 100644
--- a/docs/html/guide/google/gcm/adv.jd
+++ b/docs/html/guide/google/gcm/adv.jd
@@ -257,7 +257,7 @@ registerReceiver(mRetryReceiver, filter);
<h2 id="multi-senders">Receiving Messages from Multiple Senders</h2>
<p>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.</p>
-<p>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.</p>
+<p>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.</p>
<p>This code snippet illustrates this feature. Senders are passed as an intent extra in a comma-separated list:</p>
<pre class="prettyprint pretty-java">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
<dd>To use the GCM service, you need to obtain a Simple API Key from Google APIs console page. For more information, see <a href="gs.html">Getting Started</a>. Note that GCM <em>only</em> accepts Simple API Key&mdash;using ClientLogin or OAuth2 tokens will not work.
</dd>
<dt><strong>Sender ID</strong></dt>
-<dd>In C2DM, the Sender ID is an email address. In GCM, the Sender ID is a project ID that you acquire from the API console, as described in <a href="gs.html#create-proj">Getting Started</a>. </dd>
+<dd>In C2DM, the Sender ID is an email address. In GCM, the Sender ID is a project number that you acquire from the API console, as described in <a href="gs.html#create-proj">Getting Started</a>. </dd>
<dt><strong>JSON format</strong></dt>
<dd>GCM HTTP requests support JSON format in addition to plain text. For more information, see the <a href="gcm.html#send-msg">Architectural Overview</a>.</dd>
@@ -82,12 +82,12 @@ page.title=Migration
<p>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. </p>
<p>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.</p>
+contains an old C2DM sender or a new GCM project number. 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.</p>
<h2 id="migrating">Migrating Your Apps</h2>
<p>This section describes how to move existing C2DM apps to GCM.</p>
<h3 id="client">Client changes</h3>
-<p>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:</p>
+<p>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:</p>
<pre class="prettyprint pretty-java">Intent registrationIntent = new Intent(&quot;com.google.android.c2dm.intent.REGISTER&quot;);
// sets the app name in the intent
registrationIntent.putExtra(&quot;app&quot;, 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
<p>For the Android application:</p>
<ul>
<li>Emulator (or device) running Android 2.2 with Google APIs.</li>
- <li>The Google API project ID of the account registered to use GCM.</li>
+ <li>The Google API project number of the account registered to use GCM.</li>
</ul>
<h2 id="gcm-setup">Setting Up GCM</h2>
<p>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 <a href="https://code.google.com/apis/console">Google API Console</a>.</p>
@@ -175,7 +175,7 @@ runserver:
<pre class="prettyprint pretty-java">
static final String SERVER_URL = &quot;http://192.168.1.10:8080/gcm-demo&quot;;
static final String SENDER_ID = &quot;4815162342&quot;;</pre>
-<p>Note that the <code>SERVER_URL</code> 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 (<code>/</code>). Also note that <code>SENDER_ID</code> is the Google API project ID you obtained in the server setup steps above.</p>
+<p>Note that the <code>SERVER_URL</code> 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 (<code>/</code>). Also note that <code>SENDER_ID</code> is the Google API project number you obtained in the server setup steps above.</p>
<li>In a shell window, go to the <code>gcm-demo-client</code> directory.</li>
<li>Use the SDK's <code>android</code> tool to generate the <code>ant</code> build files:</li>
diff --git a/docs/html/guide/google/gcm/gcm.jd b/docs/html/guide/google/gcm/gcm.jd
index a47ceb9..1762e12 100644
--- a/docs/html/guide/google/gcm/gcm.jd
+++ b/docs/html/guide/google/gcm/gcm.jd
@@ -80,7 +80,6 @@ Messaging (GCM):</p>
<ul>
<li>It allows 3rd-party application servers to send messages to
their Android applications.</li>
- <li>GCM makes no guarantees about delivery or the order of messages.</li>
<li>An Android application on an Android device doesn't need to be running to receive
messages. The system will wake up the Android application via Intent broadcast when the message arrives, as long as the application is set up with the proper
broadcast receiver and permissions.</li>
@@ -133,7 +132,7 @@ application server and sending them to the device. </td>
</tr>
<tr>
<td><strong>Sender ID</strong></td>
- <td>A project ID you acquire from the API console, as described in <a href="gs.html#create-proj">Getting Started</a>. The sender
+ <td>A project number you acquire from the API console, as described in <a href="gs.html#create-proj">Getting Started</a>. The sender
ID is used in the <a href="#registering">registration process</a> to identify an
Android application that is permitted to send messages to the device.</td>
</tr>
@@ -360,7 +359,7 @@ could not run properly. </li>
</p>
<ul>
- <li><code>sender</code> is the project ID of the account authorized to send messages
+ <li><code>sender</code> is the project number of the account authorized to send messages
to the Android application. </li>
<li><code>app</code> is the Android application's ID, set with a <code>PendingIntent</code> to
allow the registration service to extract Android application information. </li>
@@ -675,6 +674,16 @@ sent. Optional. The default value is <code>false</code>, and must be a JSON bool
<td><code>time_to_live</code></td>
<td>How long (in seconds) the message should be kept on GCM storage if the device is offline. Optional (default time-to-live is 4 weeks, and must be set as a JSON number).</td>
</tr>
+<tr>
+ <td><code>restricted_package_name</code></td>
+ <td>A string containing the package name of your application. When set, messages will only be sent to registration IDs that match the package name. Optional.
+ </td>
+</tr>
+<tr>
+ <td><code>dry_run</code></td>
+ <td>If included, allows developers to test their request without actually sending a message. Optional. The default value is <code>false</code>, and must be a JSON boolean.
+ </td>
+</tr>
</table>
<p>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:
@@ -706,9 +715,19 @@ sent. Optional. The default value is <code>false</code>, and must be a JSON bool
<td><code>time_to_live</code></td>
<td>Same as JSON (see previous table). Optional.</td>
</tr>
+<tr>
+ <td><code>restricted_package_name</code></td>
+ <td>Same as JSON (see previous table). Optional.
+ </td>
+</tr>
+<tr>
+ <td><code>dry_run</code></td>
+ <td>Same as JSON (see previous table). Optional.
+ </td>
+</tr>
</table>
-
+<p>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 <code>dry_run</code> with the value <code>true</code>. 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 <a href="#response">Response format</a>).</p>
<h4 id="example-requests">Example requests</h4>
<p>Here is the smallest possible request (a message without any parameters and just one recipient) using JSON:</p>
@@ -889,7 +908,7 @@ Happens when the error code is <code>InvalidDataKey</code>.</dd>
<dt id="auth_error"><strong>Authentication Error</strong></dt>
<dd>The sender account that you're trying to use to send a message couldn't be authenticated. Possible causes are: <ul>
<li>Authorization header missing or with invalid syntax.</li>
-<li>Invalid project ID sent as key.</li>
+<li>Invalid project number sent as key.</li>
<li>Key valid but with GCM service disabled.</li>
<li>Request originated from a server not whitelisted in the Server Key IPs.</li>
@@ -944,6 +963,13 @@ Happens when the HTTP status code is 500, or when the <code>error</code> field o
object in the results array is <code>InternalServerError</code>.
</dd>
+<dt id="restricted_package_name"><strong>Invalid Package Name</strong></dt>
+
+<dd>
+A message was addressed to a registration ID whose package name did not match the value passed in the request. Happens when error code is
+<code>InvalidPackageName</code>.
+</dd>
+
</dl>
<h4>Example responses</h4>
diff --git a/docs/html/guide/google/gcm/gs.jd b/docs/html/guide/google/gcm/gs.jd
index 8d132d8..fc5c4a2 100644
--- a/docs/html/guide/google/gcm/gs.jd
+++ b/docs/html/guide/google/gcm/gs.jd
@@ -41,7 +41,7 @@ page.title=GCM: Getting Started
<pre> https://code.google.com/apis/console/#project:<strong>4815162342</strong></pre>
- <li> Take note of the value after <code>#project:</code> (4815162342 in this example). This is your project ID, and it will be used later on as the GCM sender ID.</li>
+ <li> Take note of the value after <code>#project:</code> (4815162342 in this example). This is your project number, and it will be used later on as the GCM sender ID.</li>
</ol>
<h2 id="gcm-service">Enabling the GCM Service</h2>
diff --git a/docs/html/guide/google/play/expansion-files.jd b/docs/html/guide/google/play/expansion-files.jd
index f5cda06..9cd1bb1 100644
--- a/docs/html/guide/google/play/expansion-files.jd
+++ b/docs/html/guide/google/play/expansion-files.jd
@@ -114,9 +114,10 @@ yourself or be able to distinguish between the two files.</p>
<h3 id="Filename">File name format</h3>
-<p>Each expansion file you upload can be any format you choose (ZIP, PDF, MP4, etc.). Regardless of
-the file type, Google Play considers them opaque binary blobs and renames the files
-using the following scheme:</p>
+<p>Each expansion file you upload can be any format you choose (ZIP, PDF, MP4, etc.). You can also
+use the <a href="{@docRoot}tools/help/jobb.html">JOBB</a> tool to encapsulate and encrypt a set
+of resource files and subsequent patches for that set. Regardless of the file type, Google Play
+considers them opaque binary blobs and renames the files using the following scheme:</p>
<pre class="classic no-pretty-print">
[main|patch].&lt;expansion-version&gt;.&lt;package-name&gt;.obb
@@ -136,7 +137,7 @@ value).
<p>"First" is emphasized because although the Developer Console allows you to
re-use an uploaded expansion file with a new APK, the expansion file's name does not change&mdash;it
retains the version applied to it when you first uploaded the file.</p></dd>
- <dt>{@code &lt;package-name&gt;}</dt>
+ <dt>{@code &lt;package-name&gt;}</dt>
<dd>Your application's Java-style package name.</dd>
</dl>
@@ -253,7 +254,7 @@ expansion file, you can use the patch file for the rest of your assets.</p>
<li>Develop your application such that it uses the resources from your expansion files in the
device's <a href="#StorageLocation">shared storage location</a>.
<p>Remember that you must not delete, move, or rename the expansion files.</p>
- <p>If your application doesn't demand a specific format, we suggest you create ZIP files for
+ <p>If your application doesn't demand a specific format, we suggest you create ZIP files for
your expansion files, then read them using the <a href="#ZipLib">APK Expansion Zip
Library</a>.</p>
</li>
@@ -347,7 +348,7 @@ href="#StorageLocation">shared storage location</a> (in the
<ol>
<li>Perform a request using Google Play's <a
href="{@docRoot}guide/google/play/licensing/index.html">Application Licensing</a> to get your
-app's expansion file names, sizes, and URLs.</li>
+app's expansion file names, sizes, and URLs.</li>
<li>Use the URLs provided by Google Play to download the expansion files and save
the expansion files. You <strong>must</strong> save the files to the <a
href="#StorageLocation">shared storage location</a>
@@ -651,7 +652,7 @@ public class SampleAlarmReceiver extends BroadcastReceiver {
SampleDownloaderService.class);
} catch (NameNotFoundException e) {
e.printStackTrace();
- }
+ }
}
}
</pre>
@@ -698,7 +699,7 @@ boolean expansionFilesDelivered() {
return false;
}
return true;
-}
+}
</pre>
<p>In this case, each {@code XAPKFile} object holds the version number and file size of a known
expansion file and a boolean as to whether it's the main expansion file. (See the sample
@@ -749,7 +750,7 @@ public void onCreate(Bundle savedInstanceState) {
...
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
notifierIntent, PendingIntent.FLAG_UPDATE_CURRENT);
-
+
// Start the download service (if required)
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
pendingIntent, SampleDownloaderService.class);
@@ -1050,9 +1051,9 @@ your ZIP expansion files as a virtual file system.</p>
<dl>
<dt>{@code APKExpansionSupport}</dt>
<dd>Provides some methods to access expansion file names and ZIP files:
-
+
<dl style="margin-top:1em">
- <dt>{@code getAPKExpansionFiles()}</dt>
+ <dt>{@code getAPKExpansionFiles()}</dt>
<dd>The same method shown above that returns the complete file path to both expansion
files.</dd>
<dt>{@code getAPKExpansionZipFile(Context ctx, int mainVersion, int
@@ -1063,7 +1064,7 @@ patch file. That is, if you specify both the <code>mainVersion</code> and the
all the data, with the patch file's data merged on top of the main file.</dd>
</dl>
</dd>
-
+
<dt>{@code ZipResourceFile}</dt>
<dd>Represents a ZIP file on the shared storage and performs all the work to provide a virtual
file system based on your ZIP files. You can get an instance using {@code
@@ -1083,7 +1084,7 @@ the root of the ZIP file contents. This is useful for certain Android APIs that
android.content.res.AssetFileDescriptor}, such as some {@link android.media.MediaPlayer} APIs.</dd>
</dl>
</dd>
-
+
<dt>{@code APEZProvider}</dt>
<dd>Most applications don't need to use this class. This class defines a {@link
android.content.ContentProvider} that marshals the data from the ZIP files through a content
@@ -1101,7 +1102,7 @@ following:</p>
// Get a ZipResourceFile representing a merger of both the main and patch files
ZipResourceFile expansionFile = APKExpansionSupport.getAPKExpansionZipFile(appContext,
mainVersion, patchVersion);
-
+
// Get an input stream for a known file inside the expansion file ZIPs
InputStream fileStream = expansionFile.getInputStream(pathToFileInsideZip);
</pre>
@@ -1254,7 +1255,7 @@ you can easily read all the expansion file data.</li>
<!-- Tools are not ready.
-
+
<h3>Using OBB tool and APIs</h3>
<pre>