summaryrefslogtreecommitdiffstats
path: root/docs/html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/html')
-rw-r--r--docs/html/google/gcm/adv.jd3
-rw-r--r--docs/html/google/gcm/ccs.jd58
-rw-r--r--docs/html/google/gcm/client.jd22
-rw-r--r--docs/html/google/gcm/gcm.jd2
-rw-r--r--docs/html/google/gcm/gs.jd8
-rw-r--r--docs/html/google/gcm/http.jd17
-rw-r--r--docs/html/google/gcm/index.jd6
-rw-r--r--docs/html/google/gcm/notifications.jd4
-rw-r--r--docs/html/google/gcm/server.jd132
-rw-r--r--docs/html/guide/topics/text/creating-input-method.jd345
10 files changed, 274 insertions, 323 deletions
diff --git a/docs/html/google/gcm/adv.jd b/docs/html/google/gcm/adv.jd
index 245467f..95497e3 100644
--- a/docs/html/google/gcm/adv.jd
+++ b/docs/html/google/gcm/adv.jd
@@ -261,7 +261,7 @@ is either a "send-to-sync" (collapsible) message or a "message wi
payload" (non-collapsible message). These concepts are described in more
detail in the following sections.</p>
-<h3 id="s2s"><strong>Send-to-sync messages</strong></h3>
+<h3 id="s2s">Send-to-sync messages</h3>
<p>A send-to-sync (collapsible) message is often a &quot;tickle&quot; that tells
a mobile application to sync data from the server. For example, suppose you have
@@ -288,6 +288,7 @@ and B4, and so on. If you exceed this number GCM will only keep 4 collapse keys,
guarantees about which ones they will be.</p>
<h3 id="payload">Messages with payload</h3>
+
<p>Unlike a send-to-sync message, every &quot;message with payload&quot;
(non-collapsible message) is delivered. The payload the message contains can be
up to 4kb. For example, here is a JSON-formatted message in an IM application in
diff --git a/docs/html/google/gcm/ccs.jd b/docs/html/google/gcm/ccs.jd
index 2faf97f..7db7a74 100644
--- a/docs/html/google/gcm/ccs.jd
+++ b/docs/html/google/gcm/ccs.jd
@@ -21,7 +21,7 @@ page.title=GCM Cloud Connection Server (XMPP)
</li>
<li><a href="#upstream">Upstream Messages</a>
<ol>
- <li><a href="#receipts">Receive return receipts</a></li>
+ <li><a href="#receipts">Receive delivery receipts</a></li>
</ol>
</li>
<li><a href="#flow">Flow Control</a> </li>
@@ -45,11 +45,15 @@ page.title=GCM Cloud Connection Server (XMPP)
</div>
</div>
-<p>The GCM Cloud Connection Server (CCS) is an XMPP endpoint that provides a
+<p>The Google Cloud Messaging (GCM) Cloud Connection Server (CCS) is an XMPP endpoint that provides a
persistent, asynchronous, bidirectional connection to Google servers. The
connection can be used to send and receive messages between your server and
your users' GCM-connected devices.</p>
+<p class="note"><strong>Note:</strong> The content in this document
+applies to <a href="http://developer.chrome.com/apps/cloudMessaging">
+GCM with Chrome apps</a> as well as Android.
+
<p>You can continue to use the HTTP request mechanism to send messages to GCM
servers, side-by-side with CCS which uses XMPP. Some of the benefits of CCS include:</p>
@@ -259,22 +263,6 @@ message is &quot;nack&quot;. A NACK message contains:</p>
&lt;/message&gt;
</pre>
-<p>Quota exceeded:</p>
-
-<pre>&lt;message&gt;
- &lt;gcm xmlns=&quot;google:mobile:data&quot;&gt;
- {
- &quot;message_type&quot;:&quot;nack&quot;,
- &quot;message_id&quot;:&quot;msgId1&quot;,
- &quot;from&quot;:&quot;APA91bHFOtaQGSwupt5l1og&quot;,
- &quot;error&quot;:&quot;QUOTA_EXCEEDED&quot;,
- &quot;error_description&quot;:&quot;Short-term downstream quota exceeded for this registration id&quot;
- }
- &lt;/gcm&gt;
-&lt;/message&gt;
-</pre>
-
-
<p>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}.</p>
@@ -312,11 +300,11 @@ message should be immediately retried over another connection.</td>
<td>{@code INVALID_JSON}</td>
<td>The JSON message payload is not valid.</td>
</tr>
-<tr>
-<td>{@code QUOTA_EXCEEDED}</td>
-<td>The rate of messages to a particular registration ID (in other words, to a
-sender/device pair) is too high. If you want to retry the message, try using a slower
-rate.</td>
+<td>{@code DEVICE_MESSAGE_RATE_EXCEEDED}</td>
+<td>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.</td>
</tr>
<tr>
<td>{@code SERVICE_UNAVAILABLE}</td>
@@ -429,15 +417,17 @@ response to the above message:</p>
&lt;/gcm&gt;
&lt;/message&gt;</pre>
-<h3 id="receipts">Receive return receipts</h3>
+<h3 id="receipts">Receive delivery receipts</h3>
-<p>You can use upstream messaging to get receipt notifications, confirming
-that a given message was sent to a device. Your 3rd-party app server receives the receipt
-notification from CCS once the message has been sent to the device.</p>
+<p>You can use upstream messaging to get delivery receipts (sent from CCS to
+your 3rd party app server) when
+a device confirms that it received a message sent by CCS.</p>
<p>To enable this feature, the message your 3rd-party app server sends to CCS must include
a field called <code>&quot;delivery_receipt_requested&quot;</code>. When this field is set to
-<code>true</code>, CCS sends a return receipt. Here is an XMPP stanza containing a JSON
+<code>true</code>, CCS sends a delivery receipt when a device confirms that it received a particular message.</p>
+
+<p>Here is an XMPP stanza containing a JSON
message with <code>&quot;delivery_receipt_requested&quot;</code> set to <code>true</code>:</p>
<pre>&lt;message id=&quot;&quot;&gt;
@@ -457,8 +447,10 @@ message with <code>&quot;delivery_receipt_requested&quot;</code> set to <code>tr
&lt;/message&gt;
</pre>
-<p>Here is an example of a receipt notification message that CCS sends back to your 3rd-party
-app server:</p>
+
+
+<p>Here is an example of the delivery receipt that CCS sends to tell your 3rd-party
+app server that a device received a message that CCS sent it:</p>
</p>
<pre>&lt;message id=&quot;&quot;&gt;
@@ -483,12 +475,12 @@ app server:</p>
<ul>
<li>The {@code &quot;message_type&quot;} is set to {@code &quot;receipt&quot;}.
<li>The {@code &quot;message_status&quot;} is set to {@code &quot;MESSAGE_SENT_TO_DEVICE&quot;},
- indicating that the message was delivered. Notice that in this case,
+ indicating that the device received the message. Notice that in this case,
{@code &quot;message_status&quot;} is not a field but rather part of the data payload.</li>
<li>The receipt message ID consists of the original message ID, but with a
-<code>dr:</code> prefix. Your 3rd-party app server must send an ACK back with this ID,
+<code>dr2:</code> prefix. Your 3rd-party app server must send an ACK back with this ID,
which in this example is {@code dr2:m-1366082849205}.</li>
- <li>The original message ID and status are inside the
+ <li>The original message ID, the device registration ID, and the status are inside the
{@code &quot;data&quot;} field.</li>
</ul>
diff --git a/docs/html/google/gcm/client.jd b/docs/html/google/gcm/client.jd
index 20bff10..70109c6 100644
--- a/docs/html/google/gcm/client.jd
+++ b/docs/html/google/gcm/client.jd
@@ -34,14 +34,14 @@ page.tags=cloud,push,messaging
</div>
</div>
-<p>A GCM client is a GCM-enabled app that runs on an Android device. To write your
-client code, we recommend that you use the
-<a href="{@docRoot}reference/com/google/android/gms/gcm/GoogleCloudMessaging.html">
-{@code GoogleCloudMessaging}</a> APIs.
+<p>A Google Cloud Messaging (GCM) client is a GCM-enabled app that runs on an
+Android device. To write your client code, we recommend that you use the
+<a href="{@docRoot}reference/com/google/android/gms/gcm/package-summary.html">
+GCM APIs</a>.
The client helper library that was offered in previous versions of GCM still works,
but it has been superseded by the more efficient
-<a href="{@docRoot}reference/com/google/android/gms/gcm/GoogleCloudMessaging.html">
-{@code GoogleCloudMessaging}</a> APIs.</p>
+<a href="{@docRoot}reference/com/google/android/gms/gcm/package-summary.html">
+GCM APIs</a>.</p>
<p>A full GCM implementation requires both a client implementation and a server
implementation. For more
@@ -57,8 +57,8 @@ registration ID), and a broadcast receiver to receive messages sent by GCM.
<h2 id="play-services">Step 1: Set Up Google Play Services</h2>
<p>To write your client application, use the
-<a href="{@docRoot}reference/com/google/android/gms/gcm/GoogleCloudMessaging.html">
-{@code GoogleCloudMessaging}</a> API.
+<a href="{@docRoot}reference/com/google/android/gms/gcm/package-summary.html">
+GCM APIs</a>.
To use this API, you must set up your project to use the Google Play services SDK,
as described in <a href="/google/play-services/setup.html">Setup Google Play
Services SDK</a>.</p>
@@ -159,7 +159,7 @@ could not run properly. </li>
<p>Finally, write your application. This section features a sample client
application that illustrates how to use the
<a href="{@docRoot}reference/com/google/android/gms/gcm/GoogleCloudMessaging.html">
-{@code GoogleCloudMessaging}</a> APIs. The sample consists of a main activity
+{@code GoogleCloudMessaging}</a> API. The sample consists of a main activity
({@code DemoActivity}), a {@link android.support.v4.content.WakefulBroadcastReceiver}
({@code GcmBroadcastReceiver}), and an {@link android.app.IntentService}
({@code GcmIntentService}). You can find the complete source code for this sample at the
@@ -456,7 +456,7 @@ private void storeRegistrationId(Context context, String regId) {
<p>When the user clicks the app's <strong>Send</strong> button, the app sends an
upstream message using the
<a href="{@docRoot}reference/com/google/android/gms/gcm/GoogleCloudMessaging.html">
-{@code GoogleCloudMessaging}</a> APIs. In order to receive the upstream message,
+{@code GoogleCloudMessaging}</a> API. In order to receive the upstream message,
your server should be connected to CCS. You can use one of the demo servers in
<a href="ccs.html#implement">Implementing an XMPP-based App Server</a> to run the sample and connect
to CCS.</p>
@@ -652,7 +652,7 @@ your sender ID and API key.
<p>To view statistics and any error messages for your GCM applications:</p>
<ol>
- <li> Go to the <code><a href="http://play.google.com/apps/publish">Developer Console</a></code>.</li>
+ <li> Go to the <a href="http://play.google.com/apps/publish">Developer Console</a>.</li>
<li>Login with your developer account.
<p>You will see a page that has a list of all of your apps.</p></li>
<li> Click on the &quot;statistics&quot; link next to the app for which you
diff --git a/docs/html/google/gcm/gcm.jd b/docs/html/google/gcm/gcm.jd
index 19151b9..3d6594d 100644
--- a/docs/html/google/gcm/gcm.jd
+++ b/docs/html/google/gcm/gcm.jd
@@ -21,7 +21,7 @@ page.title=Overview
</div>
</div>
-<p>Google Cloud Messaging for Android (GCM) is a free service that helps
+<p>Google Cloud Messaging (GCM) for Android is a free service that helps
developers send data from servers to their Android applications on Android
devices, and upstream messages from the user's device back to the cloud.
This could be a lightweight message telling the Android application
diff --git a/docs/html/google/gcm/gs.jd b/docs/html/google/gcm/gs.jd
index ae57b6d..a889624 100644
--- a/docs/html/google/gcm/gs.jd
+++ b/docs/html/google/gcm/gs.jd
@@ -25,12 +25,12 @@ page.tags=cloud,push,messaging
</div>
</div>
-<p>This document tells you how to get started setting up a GCM
-implementation.
+<p>This document tells you how to get started setting up a Google Cloud Messaging
+(GCM) implementation.
Before you begin, make sure to <a href="/google/play-services/setup.html">set up
the Google Play Services SDK</a>. You need this SDK to use the
-<a href="{@docRoot}reference/com/google/android/gms/gcm/GoogleCloudMessaging.html">
-{@code GoogleCloudMessaging}</a> methods.</p>
+<a href="{@docRoot}reference/com/google/android/gms/gcm/package-summary.html">
+GCM APIs</a>.</p>
<h2 id="create-proj">Creating a Google API project</h2>
<p>To create a Google API project:</p>
diff --git a/docs/html/google/gcm/http.jd b/docs/html/google/gcm/http.jd
index b8d8659..773acd1 100644
--- a/docs/html/google/gcm/http.jd
+++ b/docs/html/google/gcm/http.jd
@@ -33,13 +33,16 @@ page.title=GCM HTTP Connection Server
</div>
</div>
-<p>This document describes the GCM HTTP connection server. Connection servers
+<p>This document describes the Google Cloud Messaging (GCM) HTTP
+connection server. Connection servers
are the Google-provided servers that take messages from the 3rd-party
application server and sending them to the device.</p>
+<p class="note"><strong>Note:</strong> The content in this document
+applies to <a href="http://developer.chrome.com/apps/cloudMessaging">
+GCM with Chrome apps</a> as well as Android.</p>
-
-<p class="note"><strong>Note:</strong> See
+<p>See
<a href="server.html#params">Implementing GCM Server</a> for a list of all the message
parameters and which connection server(s) supports them.</p>
@@ -163,7 +166,7 @@ before the request can be retried.</td>
</tr>
<tr>
<td>5xx</td>
- <td>Errors in the 500-599 range (such as 500 or 503) indicate that there wa
+ <td>Errors in the 500-599 range (such as 500 or 503) indicate that there was
an internal error in the GCM server while trying to process the request, or that
the server is temporarily unavailable (for example, because of timeouts). Sender
must retry later, honoring any <code>Retry-After</code> header included in the
@@ -416,6 +419,12 @@ 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>
+
+<dt id="big_msg"><strong>Device Message Rate Exceeded</strong></dt>
+ <dd>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 retry sending to this device immediately.
+<br/>Happens when error code is <code>DeviceMessageRateExceeded</code>.</dd>
+
</dl>
<h3 id="example-responses">Example responses</h3>
diff --git a/docs/html/google/gcm/index.jd b/docs/html/google/gcm/index.jd
index 56e0865..af5d741 100644
--- a/docs/html/google/gcm/index.jd
+++ b/docs/html/google/gcm/index.jd
@@ -13,11 +13,11 @@ header.hide=1
<h1 itemprop="name" style="margin-bottom:0;">Google Cloud Messaging for Android</h1>
<p itemprop="description">
- Google Cloud Messaging for Android (GCM) is a service that allows you to send data
+ Google Cloud Messaging (GCM) for Android is a service that allows you to send data
from your server to your users' Android-powered device, and also to receive messages from
devices on the same connection. The GCM service handles all aspects of queueing of messages
-and delivery to the target Android application running on the target device. GCM is
-completely free no matter how big your messaging needs are, and there are no quotas.
+and delivery to the target Android application running on the target device, and it is
+completely free.
</p>
</div>
diff --git a/docs/html/google/gcm/notifications.jd b/docs/html/google/gcm/notifications.jd
index 2815f3d..147b69c 100644
--- a/docs/html/google/gcm/notifications.jd
+++ b/docs/html/google/gcm/notifications.jd
@@ -83,7 +83,7 @@ message body is JSON.</p>
<h2 id="gen-server">Generate a Notification Key on the Server</h2>
<p>To generate a notification key on the server, you create a new
-create a new <code>notification_key</code> and map it to a
+<code>notification_key</code> and map it to a
<code>notification_key_name</code>.</p>
<p>This example shows how to create a new <code>notification_key</code> for a
@@ -268,7 +268,7 @@ notification key operations.</p>
<p>When you make a request to create a {@code notification_key} or to add/remove its
regIDs, a successful response always returns the <code>notification_key</code>.
-his is the {@code notification_key} you will use for sending messages:</p>
+Use the returned {@code notification_key} for sending messages:</p>
<pre>HTTP status: 200
{
diff --git a/docs/html/google/gcm/server.jd b/docs/html/google/gcm/server.jd
index e3a6b25..20e2b2e 100644
--- a/docs/html/google/gcm/server.jd
+++ b/docs/html/google/gcm/server.jd
@@ -37,7 +37,7 @@ page.title=Implementing GCM Server
</div>
-<p>The server side of GCM consists of 2 components:</p>
+<p>The server side of Google Cloud Messaging (GCM) consists of 2 components:</p>
<ul>
<li>Google-provided <strong>GCM Connection Servers</strong>
take messages from a 3rd-party application server and send them to a GCM-enabled
@@ -168,36 +168,37 @@ column for information about which connection servers support that particular
parameter.</p>
<p class="table-caption" id="table1">
- <strong>Table 1.</strong> Message parameters.</p>
+ <strong>Table 1.</strong> Message Parameters JSON (CCS and HTTP).</p>
<table>
<tr>
- <th>Field</th>
+ <th>Parameter</th>
<th>Description</th>
<th>Where Supported</th>
</tr>
<td><code>to</code></td>
-<td>In CCS, used in place of <code>registration_ids</code> to specify the
-recipient of a message. Its value must be a registration ID.
+<td>In CCS, this parameter is used in place of <code>registration_ids</code> to
+specify the recipient of a message. Its value must be a registration ID.
The value is a string. Required.</td>
<td>CCS</td>
</tr>
<tr>
<td><code>message_id</code></td>
-<td>In CCS, uniquely identifies a message in an XMPP connection. The value is a
-string that uniquely identifies the associated message. The value is a string. Required.</td>
+<td>In CCS, this parameter uniquely identifies a message in an XMPP connection.
+The value is a string that uniquely identifies the associated message. Required.</td>
<td>CCS</td>
</tr>
<tr>
<td><code>message_type</code></td>
-<td>In CCS, indicates a special status message, typically sent by the system.
+<td>In CCS, this parameter indicates a special status message, typically sent by the system.
However, your app server also uses this parameter to send an 'ack' or 'nack'
message back to the CCS connection server. For more discussion of this topic, see
<a href="ccs.html">Cloud Connection Server</a>. The value is a string. Optional.</td>
<td>CCS</td>
<tr>
<td><code>registration_ids</code></td>
- <td>A string array with the list of devices (registration IDs) receiving the
+ <td>This parameter specifies a string array containing the list of devices
+(registration IDs) receiving the
message. It must contain at least 1 and at most 1000 registration IDs. To send a
multicast message, you must use JSON. For sending a single message to a single
device, you could use a JSON object with just 1 registration id, or plain text
@@ -208,12 +209,13 @@ Required.</td>
</tr>
<tr>
<td><code>notification_key</code></td>
- <td>A string that maps a single user to multiple registration IDs associated
+ <td>This parameter specifies a string that maps a single user to multiple
+registration IDs associated
with that user. This allows a 3rd-party server to send a single message to
multiple app instances (typically on multiple devices) owned by a single user.
A 3rd-party server can use {@code notification_key} as the target for a message
instead of an individual registration ID (or array of registration IDs). The maximum
-number of members allowed for a {@code notification_key} is 10. For more discussion
+number of members allowed for a {@code notification_key} is 20. For more discussion
of this topic, see <a href="notifications.html">User Notifications</a>. Optional.
</td>
<td style="width:100px">HTTP. This feature is supported in CCS, but you use it by
@@ -221,13 +223,14 @@ specifying a notification key in the &quot;to&quot; field.</td>
</tr>
<tr>
<td><code>collapse_key</code></td>
- <td>An arbitrary string (such as &quot;Updates Available&quot;) that is used
+ <td>This parameter specifies an arbitrary string (such as
+&quot;Updates Available&quot;) that is used
to collapse a group of like messages
when the device is offline, so that only the last message gets sent to the
client. This is intended to avoid sending too many messages to the phone when it
comes back online. Note that since there is no guarantee of the order in which
messages get sent, the &quot;last&quot; message may not actually be the last
-message sent by the application server. Collapse keys are also called
+message sent by the application server. Messages with collapse keys are also called
<a href="#s2s">send-to-sync messages</a>.
<br>
<strong>Note:</strong> GCM allows a maximum of 4 different collapse keys to be
@@ -242,8 +245,9 @@ discussion of this topic. Optional.</td>
</tr>
<tr>
<td><code>data</code></td>
- <td>A JSON object whose fields represents the key-value pairs of the message's
-payload data. If present, the payload data it will be
+ <td>This parameter specifies a JSON object whose fields represents the
+key-value pairs of the message's
+payload data. If present, the payload data will be
included in the Intent as application data, with the key being the extra's name.
For instance, <code>"data":{"score":"3x1"}</code> would result in an intent extra
named <code>score</code> whose value is the string <code>3x1</code>.
@@ -253,17 +257,14 @@ recommend using strings, since the values will be converted to strings in the GC
server anyway. If you want to include objects or other non-string data types
(such as integers or booleans), you have to do the conversion to string yourself.
Also note that the key cannot be a reserved word (<code>from</code> or any word
-starting with <code>google.</code>). To complicate things slightly, there are
-some reserved words (such as <code>collapse_key</code>) that are technically
-allowed in payload data. However, if the request also contains the word, the
-value in the request will overwrite the value in the payload data. Hence using
-words that are defined as field names in this table is not recommended, even in
-cases where they are technically allowed. Optional.</td>
+starting with <code>google.</code>). Using words defined in this table as field
+names (such as <code>collapse_key</code>) could yield unpredictable outcomes and
+is not recommended. Optional.</td>
<td>CCS, HTTP</td>
</tr>
<tr>
<td><code>delay_while_idle</code></td>
- <td>If included, indicates that the message should not be sent immediately
+ <td>This parameter indicates that the message should not be sent immediately
if the device is idle. The server will wait for the device to become active, and
then only the last message for each <code>collapse_key</code> value will be
sent. The default value is <code>false</code>, and must be a JSON boolean. Optional.</td>
@@ -271,26 +272,70 @@ sent. The default value is <code>false</code>, and must be a JSON boolean. Optio
</tr>
<tr>
<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
+ <td>This parameter specifies 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>
<td>CCS, HTTP</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>This parameter specifies a string containing the package
+name of your application. When set, messages
+are only sent to registration IDs that match the package name. Optional.
</td>
<td>HTTP</td>
</tr>
<tr>
<td><code>dry_run</code></td>
- <td>If included, allows developers to test their request without actually
+ <td>This parameter allows developers to test a request without actually
sending a message. Optional. The default value is <code>false</code>, and must
be a JSON boolean.
</td>
<td>HTTP</td>
</tr>
+<tr>
+ <td><code>delivery_receipt_requested</code></td>
+ <td>This parameter lets you request confirmation of message delivery. When
+this parameter is set to <code>true</code>, CCS sends a
+delivery receipt when a device confirms that it received a message sent by CCS.
+The default value is <code>false</code>, and must be a JSON boolean. Optional.<br />
+This parameter relates to <a href="{@docRoot}google/gcm/ccs.html#receipts"}>
+delivery receipts</a>.
+</td>
+ <td>CCS</td>
+</tr>
+<tr>
+ <td><code>message_status</code></td>
+ <td>This parameter specifies the status of the receipt message.
+The parameter appears inside the
+<code>&quot;data&quot;</code> field of a
+delivery receipt message. Currently the only possible value
+is <code>MESSAGE_SENT_TO_DEVICE</code>, which indicates that a device acknowledges
+receiving a message sent by CCS.<br />
+This parameter relates to <a href="{@docRoot}google/gcm/ccs.html#receipts"}>
+delivery receipts</a>.</td>
+ <td>CCS</td>
+</tr>
+<tr>
+ <td><code>original_message_id</code></td>
+ <td>The value of this parameter is the ID of the original message that the server sent to
+the device. This parameter appears inside the <code>&quot;data&quot;</code> field of a
+delivery receipt message. <br />
+This parameter relates to <a href="{@docRoot}google/gcm/ccs.html#receipts"}>
+delivery receipts</a>.</td>
+ <td>CCS</td>
+</tr>
+<tr>
+ <td><code>device_registration_id</code></td>
+ <td>For the purpose of tracking the delivery receipt, this parameter lists
+the registration ID of the device to which a given message was sent. This parameter
+appears inside the <code>&quot;data&quot;</code> field of a
+delivery receipt message. <br />
+This parameter relates to <a href="{@docRoot}google/gcm/ccs.html#receipts"}>
+delivery receipts</a>.</td>
+ <td>CCS</td>
+</tr>
+
</table>
<p>If you want to test your request (either JSON or plain text) without delivering
@@ -298,21 +343,23 @@ the message to the devices, you can set an optional HTTP or JSON parameter calle
<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.</p>
-
-<h3 id="plain-text">Plain text (HTTP only)</h3>
+IDs for the message and multicast parameters.</p>
-<p>If you are using plain text instead of JSON, the message fields must be set as
+<p>If you are using plain text instead of JSON, the message parameters must be set as
HTTP parameters sent in the body, and their syntax is slightly different, as
-described below:
+described in the following table:
+
+<p class="table-caption" id="table2">
+ <strong>Table 2.</strong> Message Parameters Plain Text (HTTP only).</p>
<table>
<tr>
- <th>Field</th>
+ <th>Parameter</th>
<th>Description</th>
</tr>
<tr>
<td><code>registration_id</code></td>
- <td>Must contain the registration ID of the single device receiving the message.
+ <td>This parameter specifies the registration ID of the single device
+receiving the message.
Required.</td>
</tr>
<tr>
@@ -322,24 +369,23 @@ Required.</td>
<tr>
<td><code>data.&lt;key&gt;</code></td>
- <td>Payload data, expressed as parameters prefixed with <code>data.</code> and
+ <td>This parameter specifies payload data, expressed as parameters
+prefixed with <code>data.</code> and
suffixed as the key. For instance, a parameter of <code>data.score=3x1</code> would
result in an intent extra named <code>score</code> whose value is the string
<code>3x1</code>. There is no limit on the number of key/value parameters, though
there is a limit on the total size of the message. Also note that the key cannot
be a reserved word (<code>from</code> or any word starting with
-<code>google.</code>). To complicate things slightly, there are some reserved words
-(such as <code>collapse_key</code>) that are technically allowed in payload data.
-However, if the request also contains the word, the value in the request will
-overwrite the value in the payload data. Hence using words that are defined as
-field names in this table is not recommended, even in cases where they are
-technically allowed. Optional.</td>
+<code>google.</code>). Using words defined in this table as field
+names (such as <code>collapse_key</code>) could yield unpredictable outcomes and
+is not recommended. Optional.</td>
</tr>
<tr>
<td><code>delay_while_idle</code></td>
- <td>Should be represented as <code>1</code> or <code>true</code> for
-<code>true</code>, anything else for <code>false</code>. Optional. The default
+ <td>This parameter specifies whether messages should be delivered when the device
+is asleep. A value of <code>1</code> or <code>true</code> indicates
+<code>true</code>, and anything else indicates <code>false</code>. Optional. The default
value is <code>false</code>.</td>
</tr>
<tr>
diff --git a/docs/html/guide/topics/text/creating-input-method.jd b/docs/html/guide/topics/text/creating-input-method.jd
index 802b58a..424a21c 100644
--- a/docs/html/guide/topics/text/creating-input-method.jd
+++ b/docs/html/guide/topics/text/creating-input-method.jd
@@ -41,8 +41,8 @@ page.tags=ime,keyboard,inputmethodservice
<p>
To add an IME to the Android system, you create an Android application
containing a class that extends {@link android.inputmethodservice.InputMethodService}. In
- addition, you usually create a "settings" activity that passes options to the IME
- service. You can also define a settings UI that's displayed as part of the system settings.
+ addition, you usually create a "settings" activity that passes options to the IME service. You
+ can also define a settings UI that's displayed as part of the system settings.
</p>
<p>This guide covers the following:</p>
<ul>
@@ -70,29 +70,22 @@ page.tags=ime,keyboard,inputmethodservice
<strong>Figure 1.</strong> The life cycle of an IME.
</p>
<p>
- The following sections describe how to implement the UI and code associated
-with an IME that
+ The following sections describe how to implement the UI and code associated with an IME that
follows this lifecycle.
</p>
<h2 id="DefiningIME">Declaring IME Components in the Manifest</h2>
<p>
- In the Android system, an IME is an Android application that contains a
-special IME service.
- The application's manifest file must declare the service, request the
-necessary permissions,
- provide an intent filter that matches the action
-<code>action.view.InputMethod</code>, and
- provide metadata that defines characteristics of the IME. In addition, to
-provide a settings
- interface that allows the user to modify the behavior of the IME, you can
-define a "settings"
+ In the Android system, an IME is an Android application that contains a special IME service.
+ The application's manifest file must declare the service, request the necessary permissions,
+ provide an intent filter that matches the action <code>action.view.InputMethod</code>, and
+ provide metadata that defines characteristics of the IME. In addition, to provide a settings
+ interface that allows the user to modify the behavior of the IME, you can define a "settings"
activity that can be launched from System Settings.
</p>
<p>
The following snippet declares an IME service. It requests the permission
-{@link android.Manifest.permission#BIND_INPUT_METHOD} to allow the service to
-connect the IME to
- the system, sets up an intent filter that matches the action
+ {@link android.Manifest.permission#BIND_INPUT_METHOD} to allow the service to connect the IME
+ to the system, sets up an intent filter that matches the action
<code>android.view.InputMethod</code>, and defines metadata for the IME:
</p>
<pre>
@@ -108,10 +101,8 @@ android:resource="&#64;xml/method" /&gt;
&lt;/service&gt;
</pre>
<p>
- This next snippet declares the settings activity for the IME. It has an
-intent filter for
- {@link android.content.Intent#ACTION_MAIN} that indicates this activity is
-the main entry point
+ This next snippet declares the settings activity for the IME. It has an intent filter for
+ {@link android.content.Intent#ACTION_MAIN} that indicates this activity is the main entry point
for the IME application:</p>
<pre>
&lt;!-- Optional: an activity for controlling the IME settings --&gt;
@@ -127,23 +118,18 @@ the main entry point
</p>
<h2 id="IMEAPI">The Input Method API</h2>
<p>
- Classes specific to IMEs are found in the {@link android.inputmethodservice} and {@link android.view.inputmethod}
- packages. The {@link android.view.KeyEvent} class is important for handling keyboard
- characters.
+ Classes specific to IMEs are found in the {@link android.inputmethodservice} and
+ {@link android.view.inputmethod} packages. The {@link android.view.KeyEvent} class is
+ important for handling keyboard characters.
</p>
<p>
The central part of an IME is a service component, a class that extends
- {@link android.inputmethodservice.InputMethodService}. In addition to
-implementing the
- normal service lifecycle, this class has callbacks for providing your IME's
-UI, handling user
- input, and delivering text to the field that currently has focus. By
-default, the
- {@link android.inputmethodservice.InputMethodService} class provides most
-of the implementation
- for managing the state and visibility of the IME and communicating with the
-current
- input field.
+ {@link android.inputmethodservice.InputMethodService}. In addition to implementing the
+ normal service lifecycle, this class has callbacks for providing your IME's UI, handling user
+ input, and delivering text to the field that currently has focus. By default, the
+ {@link android.inputmethodservice.InputMethodService} class provides most of the implementation
+ for managing the state and visibility of the IME and communicating with the current input
+ field.
</p>
<p>
The following classes are also important:
@@ -152,45 +138,32 @@ current
<dt>{@link android.view.inputmethod.BaseInputConnection}</dt>
<dd>
Defines the communication channel from an {@link android.view.inputmethod.InputMethod}
- back to the application that is receiving its input. You use it to read
-text around the
- cursor, commit text to the text box, and send raw key events to the
-application.
- Applications should extend this class rather than implementing the base
-interface
+ back to the application that is receiving its input. You use it to read text around the
+ cursor, commit text to the text box, and send raw key events to the application.
+ Applications should extend this class rather than implementing the base interface
{@link android.view.inputmethod.InputConnection}.
</dd>
<dt>{@link android.inputmethodservice.KeyboardView}</dt>
<dd>
- An extension of {@link android.view.View} that renders a keyboard and
-responds to user
+ An extension of {@link android.view.View} that renders a keyboard and responds to user
input events. The keyboard layout is specified by an instance of
- {@link android.inputmethodservice.Keyboard}, which you can define in an
-XML file.
+ {@link android.inputmethodservice.Keyboard}, which you can define in an XML file.
</dd>
</dl>
<h2 id="IMEUI">Designing the Input Method UI</h2>
<p>
- There are two main visual elements for an IME: the <strong>input</strong>
-view and the
- <strong>candidates</strong> view. You only have to implement the elements
-that are relevant to
+ There are two main visual elements for an IME: the <strong>input</strong> view and the
+ <strong>candidates</strong> view. You only have to implement the elements that are relevant to
the input method you're designing.
</p>
<h3 id="InputView">Input view</h3>
<p>
- The input view is the UI where the user inputs text in the form of
-keyclicks, handwriting or
- gestures. When the IME is displayed for the first time, the system calls
-the
- {@link android.inputmethodservice.InputMethodService#onCreateInputView()}
-callback. In your
- implementation of this method, you create the layout you want to display in
-the IME
- window and return the layout to the system. This snippet is an example of
-implementing the
- {@link android.inputmethodservice.InputMethodService#onCreateInputView()}
-method:
+ The input view is the UI where the user inputs text in the form of keyclicks, handwriting or
+ gestures. When the IME is displayed for the first time, the system calls the
+ {@link android.inputmethodservice.InputMethodService#onCreateInputView()} callback. In your
+ implementation of this method, you create the layout you want to display in the IME
+ window and return the layout to the system. This snippet is an example of implementing the
+ {@link android.inputmethodservice.InputMethodService#onCreateInputView()} method:
<pre>
&#64;Override
public View onCreateInputView() {
@@ -215,17 +188,12 @@ traditional QWERTY keyboard,
</p>
<h3 id="CandidateView">Candidates view</h3>
<p>
- The candidates view is the UI where the IME displays potential word
-corrections or
+ The candidates view is the UI where the IME displays potential word corrections or
suggestions for the user to select. In the IME lifecycle, the system calls
- {@link android.inputmethodservice.InputMethodService#onCreateCandidatesView()} when
-it's ready
- to display the candidates view. In your implementation of this method,
-return a layout that shows
- word suggestions, or return null if you don’t want to show anything. A
-null response is the
- default behavior, so you don’t have to implement this if you don’t
-provide suggestions.</p>
+ {@link android.inputmethodservice.InputMethodService#onCreateCandidatesView()} when it's ready
+ to display the candidates view. In your implementation of this method, return a layout that
+ shows word suggestions, or return null if you don’t want to show anything. A null response is
+ the default behavior, so you don’t have to implement this if you don’t provide suggestions.</p>
<p>
For an example implementation that provides user suggestions, see the
<a href="https://android.googlesource.com/platform/development/+/master/samples/SoftKeyboard/">
@@ -237,32 +205,22 @@ provide suggestions.</p>
</p>
<h4>Handling multiple screen sizes</h4>
<p>
- The UI for your IME must be able to scale for different screen sizes, and
-it also
- must handle both landscape and portrait orientations. In non-fullscreen IME
-mode, leave
- sufficient space for the application to show the text field and any
-associated context, so that
- no more than half the screen is occupied by the IME. In fullscreen IME mode
-this is not an
+ The UI for your IME must be able to scale for different screen sizes, and it also
+ must handle both landscape and portrait orientations. In non-fullscreen IME mode, leave
+ sufficient space for the application to show the text field and any associated context, so that
+ no more than half the screen is occupied by the IME. In fullscreen IME mode this is not an
issue.
</p>
<h4>Handling different input types</h4>
<p>
- Android text fields allow you to set a specific input type, such as free
-form text, numbers,
- URLs, email addresses, and search strings. When you implement a new IME,
-you need to
- detect the input type of each field and provide the appropriate interface
-for it. However, you
- don't have to set up your IME to check that the user entered text
-valid for the
- input type; that's the responsibility of the application that owns the text
-field.
+ Android text fields allow you to set a specific input type, such as free-form text, numbers,
+ URLs, email addresses, and search strings. When you implement a new IME, you need to detect
+ the input type of each field and provide the appropriate interface for it. However, you
+ don't have to set up your IME to check that the user entered text valid for the input type;
+ that's the responsibility of the application that owns the text field.
</p>
<p>
- For example, here are screenshots of the interfaces that the Latin IME
-provided with the
+ For example, here are screenshots of the interfaces that the Latin IME provided with the
Android platform provides for text and phone number inputs:
</p>
<img src="{@docRoot}resources/articles/images/inputmethod_text_type_screenshot.png" alt="" height="142" id="figure2" />
@@ -273,18 +231,14 @@ provided with the
<p>
When an input field receives focus and your IME starts, the system calls
{@link android.inputmethodservice.InputMethodService#onStartInputView(EditorInfo, boolean) onStartInputView()},
- passing in an {@link android.view.inputmethod.EditorInfo} object that
- contains details about the input type and other attributes of the text
-field. In this object,
- the {@link android.view.inputmethod.EditorInfo#inputType} field contains
-the text field's input
+ passing in an {@link android.view.inputmethod.EditorInfo} object that contains details about
+ the input type and other attributes of the text field. In this object, the
+ {@link android.view.inputmethod.EditorInfo#inputType} field contains the text field's input
type.
</p>
<p>
- The {@link android.view.inputmethod.EditorInfo#inputType} field is an
-<code>int</code>
- that contains bit patterns for various input type settings. To test it for
-the text field's
+ The {@link android.view.inputmethod.EditorInfo#inputType} field is an <code>int</code>
+ that contains bit patterns for various input type settings. To test it for the text field's
input type, mask it with the constant {@link android.text.InputType#TYPE_MASK_CLASS}, like
this:
</p>
@@ -297,8 +251,7 @@ The input type bit pattern can have one of several values, including:
<dl>
<dt>{@link android.text.InputType#TYPE_CLASS_NUMBER}</dt>
<dd>
- A text field for entering numbers. As illustrated in the previous
-screen shot, the
+ A text field for entering numbers. As illustrated in the previous screen shot, the
Latin IME displays a number pad for fields of this type.
</dd>
<dt>{@link android.text.InputType#TYPE_CLASS_DATETIME}</dt>
@@ -315,103 +268,86 @@ screen shot, the
</dd>
</dl>
<p>
- These constants are described in more detail in the reference documentation
-for
+ These constants are described in more detail in the reference documentation for
{@link android.text.InputType}.
</p>
<p>
- The {@link android.view.inputmethod.EditorInfo#inputType} field can contain
-other bits that
+ The {@link android.view.inputmethod.EditorInfo#inputType} field can contain other bits that
indicate a variant of the text field type, such as:
</p>
<dl>
<dt>{@link android.text.InputType#TYPE_TEXT_VARIATION_PASSWORD}</dt>
<dd>
- A variant of {@link android.text.InputType#TYPE_CLASS_TEXT} for
-entering passwords. The
+ A variant of {@link android.text.InputType#TYPE_CLASS_TEXT} for entering passwords. The
input method will display dingbats instead of the actual text.
</dd>
<dt>{@link android.text.InputType#TYPE_TEXT_VARIATION_URI}</dt>
<dd>
- A variant of {@link android.text.InputType#TYPE_CLASS_TEXT} for
-entering web URLs and
+ A variant of {@link android.text.InputType#TYPE_CLASS_TEXT} for entering web URLs and
other Uniform Resource Identifiers (URIs).
</dd>
<dt>{@link android.text.InputType#TYPE_TEXT_FLAG_AUTO_COMPLETE}</dt>
<dd>
- A variant of {@link android.text.InputType#TYPE_CLASS_TEXT} for
-entering text that the
- application "auto-completes" from a dictionary, search, or other
-facility.
+ A variant of {@link android.text.InputType#TYPE_CLASS_TEXT} for entering text that the
+ application "auto-completes" from a dictionary, search, or other facility.
</dd>
</dl>
<p>
- Remember to mask {@link android.view.inputmethod.EditorInfo#inputType} with
-the appropriate
- constant when you test for these variants. The available mask constants are
-listed in the
+ Remember to mask {@link android.view.inputmethod.EditorInfo#inputType} with the appropriate
+ constant when you test for these variants. The available mask constants are listed in the
reference documentation for {@link android.text.InputType}.
</p>
<p class="caution">
- <strong>Caution:</strong> In your own IME, make sure you handle text
-correctly when you send it
- to a password field. Hide the password in your UI both in the input view
-and in the candidates
- view. Also remember that you shouldn't store passwords on a device. To
-learn more, see the <a href="{@docRoot}guide/practices/security.html">Designing for Security</a>
- guide.
+ <strong>Caution:</strong> In your own IME, make sure you handle text correctly when you send it
+ to a password field. Hide the password in your UI both in the input view and in the candidates
+ view. Also remember that you shouldn't store passwords on a device. To learn more, see the
+ <a href="{@docRoot}guide/practices/security.html">Designing for Security</a> guide.
</p>
<h2 id="SendText">Sending Text to the Application</h2>
<p>
- As the user inputs text with your IME, you can send text to the application
-by
- sending individual key events or by editing the text around the cursor in
-the application's text
+ As the user inputs text with your IME, you can send text to the application by sending
+ individual key events or by editing the text around the cursor in the application's text
field. In either case, you use an instance of {@link android.view.inputmethod.InputConnection}
to deliver the text. To get this instance, call
{@link android.inputmethodservice.InputMethodService#getCurrentInputConnection InputMethodService.getCurrentInputConnection()}.
</p>
<h3 id="EditingCursor">Editing the text around the cursor</h3>
<p>
- When you're handling the editing of existing text in a text field, some of
-the more useful
+ When you're handling the editing of existing text in a text field, some of the more useful
methods in {@link android.view.inputmethod.BaseInputConnection} are:
</p>
<dl>
<dt>
{@link android.view.inputmethod.BaseInputConnection#getTextBeforeCursor(int, int) getTextBeforeCursor()}</dt>
<dd>
- Returns a {@link java.lang.CharSequence} containing the number of
-requested characters
+ Returns a {@link java.lang.CharSequence} containing the number of requested characters
before the current cursor position.
</dd>
<dt>
{@link android.view.inputmethod.BaseInputConnection#getTextAfterCursor(int, int) getTextAfterCursor()}
</dt>
<dd>
- Returns a {@link java.lang.CharSequence} containing the number of
-requested characters following the current cursor position.
+ Returns a {@link java.lang.CharSequence} containing the number of requested characters
+ following the current cursor position.
</dd>
<dt>
{@link android.view.inputmethod.BaseInputConnection#deleteSurroundingText(int, int) deleteSurroundingText()}
</dt>
<dd>
- Deletes the specified number of characters before and following the
-current cursor
+ Deletes the specified number of characters before and following the current cursor
position.
</dd>
<dt>
{@link android.view.inputmethod.BaseInputConnection#commitText(CharSequence, int) commitText()}
</dt>
<dd>
- Commit a {@link java.lang.CharSequence} to the text field and set a new
-cursor
+ Commit a {@link java.lang.CharSequence} to the text field and set a new cursor
position.
</dd>
</dl>
<p>
- For example, the following snippet shows how to replace the four characters to
-the left of the cursor with the text "Hello!":
+ For example, the following snippet shows how to replace the four characters to the left of the
+ cursor with the text "Hello!":
</p>
<pre>
InputConnection ic = getCurrentInputConnection();
@@ -424,12 +360,9 @@ the left of the cursor with the text "Hello!":
</pre>
<h3 id="ComposeThenCommit">Composing text before committing</h3>
<p>
- If your IME does text prediction or requires multiple steps to compose a
-glyph or
- word, you can show the progress in the text field until the user commits
-the word, and then you
- can replace the partial composition with the completed text. You may give
-special treatment to
+ If your IME does text prediction or requires multiple steps to compose a glyph or
+ word, you can show the progress in the text field until the user commits the word, and then you
+ can replace the partial composition with the completed text. You may give special treatment to
the text by adding a "span" to it when you pass it to
{@link android.view.inputmethod.InputConnection#setComposingText setComposingText()}.
</p>
@@ -465,14 +398,10 @@ alt="" height="31"
</p>
<h3 id="HardwareKeyEvents">Intercepting hardware key events</h3>
<p>
- Even though the input method window doesn't have explicit focus, it
-receives hardware key
- events first and can choose to consume them or forward them along to the
-application. For
- example, you may want to consume the directional keys to navigate within
-your UI for candidate
- selection during composition. You may also want to trap the back key to
-dismiss any popups
+ Even though the input method window doesn't have explicit focus, it receives hardware key
+ events first and can choose to consume them or forward them along to the application. For
+ example, you may want to consume the directional keys to navigate within your UI for candidate
+ selection during composition. You may also want to trap the back key to dismiss any popups
originating from the input method window.</p>
<p>
To intercept hardware keys, override
@@ -483,45 +412,36 @@ dismiss any popups
SoftKeyboard</a> sample app for an example.
</p>
<p>
- Remember to call the <code>super()</code> method for keys you don't want to
-handle yourself.
+ Remember to call the <code>super()</code> method for keys you don't want to handle yourself.
</p>
<h2 id="IMESubTypes">Creating an IME Subtype</h2>
<p>
- Subtypes allow the IME to expose multiple input modes and languages
-supported by an IME. A subtype can represent:
+ Subtypes allow the IME to expose multiple input modes and languages supported by an IME. A
+ subtype can represent:
</p>
<ul>
<li>A locale such as en_US or fr_FR</li>
<li>An input mode such as voice, keyboard, or handwriting</li>
<li>
- Other input styles, forms, or properties specific to the IME, such as
-10-key or qwerty
+ Other input styles, forms, or properties specific to the IME, such as 10-key or qwerty
keyboard layouts.
</li>
</ul>
<p>
- Basically, the mode can be any text such as "keyboard", "voice", and so
-forth. A subtype can also expose a combination of these.
+ Basically, the mode can be any text such as "keyboard", "voice", and so forth. A subtype can
+ also expose a combination of these.
</p>
<p>
- Subtype information is used for an IME switcher dialog that's available
-from the notification
- bar and also for IME settings. The information also allows the framework to
-bring up a
- specific subtype of an IME directly. When you build an IME, use the subtype
-facility, because
- it helps the user identify and switch between different IME languages and
-modes.
-</p>
-<p>
- You define subtypes in one of the input method's XML resource files, using
-the
- <code>&lt;subtype&gt;</code> element. The following snippet defines an IME
-with two
- subtypes: a keyboard subtype for the US English locale, and another
-keyboard subtype for the
+ Subtype information is used for an IME switcher dialog that's available from the notification
+ bar and also for IME settings. The information also allows the framework to bring up a
+ specific subtype of an IME directly. When you build an IME, use the subtype facility, because
+ it helps the user identify and switch between different IME languages and modes.
+</p>
+<p>
+ You define subtypes in one of the input method's XML resource files, using the
+ <code>&lt;subtype&gt;</code> element. The following snippet defines an IME with two
+ subtypes: a keyboard subtype for the US English locale, and another keyboard subtype for the
French language locale for France:
</p>
<pre>
@@ -546,10 +466,8 @@ keyboard subtype for the
/&gt;
</pre>
<p>
- To ensure that your subtypes are labeled correctly in the UI, use %s to get
-a subtype label
- that is the same as the subtype’s locale label. This is demonstrated in
-the next two snippets.
+ To ensure that your subtypes are labeled correctly in the UI, use %s to get a subtype label
+ that is the same as the subtype’s locale label. This is demonstrated in the next two snippets.
The first snippet shows part of the input method's XML file:
</p>
<pre>
@@ -560,10 +478,8 @@ the next two snippets.
android:imeSubtypeMode="keyboard" /&gt;
</pre>
<p>
- The next snippet is part of the IME's <code>strings.xml</code> file. The
-string
- resource <code>label_subtype_generic</code>, which is used by the input
-method UI definition to
+ The next snippet is part of the IME's <code>strings.xml</code> file. The string
+ resource <code>label_subtype_generic</code>, which is used by the input method UI definition to
set the subtype's label, is defined as:
</p>
<pre>
@@ -575,12 +491,9 @@ method UI definition to
</p>
<h3 id="SubtypeProcessing">Choosing IME subtypes from the notification bar</h3>
<p>
- The Android system manages all subtypes exposed by all IMEs. IME subtypes
-are
- treated as modes of the IME they belong to. In the notification bar, a user
-can select an
- available subtype for the currently-set IME, as shown in the following
-screenshot:
+ The Android system manages all subtypes exposed by all IMEs. IME subtypes are
+ treated as modes of the IME they belong to. In the notification bar, a user can select an
+ available subtype for the currently-set IME, as shown in the following screenshot:
</p>
<img
src="{@docRoot}resources/articles/images/inputmethod_subtype_notification.png"
@@ -599,9 +512,9 @@ alt=""
</p>
<h3 id="SubtypeSettings">Choosing IME subtypes from System Settings</h3>
<p>
- A user can control how subtypes are used in the “Language &amp; input”
-settings panel in the
- System Settings area. In the <a href="https://android.googlesource.com/platform/development/+/master/samples/SoftKeyboard/">
+ A user can control how subtypes are used in the “Language &amp; input” settings panel in the
+ System Settings area. In the
+ <a href="https://android.googlesource.com/platform/development/+/master/samples/SoftKeyboard/">
SoftKeyboard</a> sample app, the file <code>InputMethodSettingsFragment.java</code> contains an
implementation that facilitates a subtype enabler in the IME settings. Refer to the
<a href="https://android.googlesource.com/platform/development/+/master/samples/SoftKeyboard/">
@@ -617,15 +530,14 @@ alt=""
<h2 id="Switching">Switching among IME Subtypes</h2>
-<p>You can allow users to switch easily among multiple IME subtypes by providing
-a switching key, such as the globe-shaped language icon, as part of the keyboard. Doing so greatly
-improves the keyboard's usability, and can help avoid user frustration.
+<p>You can allow users to switch easily among multiple IME subtypes by providing a switching key,
+such as the globe-shaped language icon, as part of the keyboard. Doing so greatly improves the
+keyboard's usability, and can help avoid user frustration.
To enable such switching, perform the following steps:</p>
<p>
<ol>
- <li>Declare <code>supportsSwitchingToNextInputMethod = "true"</code> in the
-input method's XML resource files. Your declaration
- should look similar to the following snippet:
+ <li>Declare <code>supportsSwitchingToNextInputMethod = "true"</code> in the input method's XML
+ resource files. Your declaration should look similar to the following snippet:
<pre>
&lt;input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.example.softkeyboard.Settings"
@@ -646,8 +558,7 @@ input method's XML resource files. Your declaration
<strong>Caution:</strong> Prior to Android 5.0 (API level 21),
{@link android.view.inputmethod.InputMethodManager#switchToNextInputMethod switchToNextInputMethod()}
is not aware of the <code>supportsSwitchingToNextInputMethod</code> attribute. If the user switches
-into an IME without a switching key, he or she may get stuck in that IME, unable to switch out of it
-easily.</p>
+into an IME without a switching key, he or she may get stuck in that IME, unable to switch out of it easily.</p>
<p>
@@ -662,31 +573,23 @@ easily.</p>
Provide a way for users to set options directly from the IME's UI.
</li>
<li>
- Because multiple IMEs may be installed on the device, provide a way for the
-user to switch to a
+ Because multiple IMEs may be installed on the device, provide a way for the user to switch to a
different IME directly from the input method UI.
</li>
<li>
- Bring up the IME's UI quickly. Preload or load on demand any large
-resources so that users
- see the IME as soon as they tap on a text field. Cache resources and views
-for subsequent
+ Bring up the IME's UI quickly. Preload or load on demand any large resources so that users
+ see the IME as soon as they tap on a text field. Cache resources and views for subsequent
invocations of the input method.
</li>
<li>
- Conversely, you should release large memory allocations soon after the
-input method window is
- hidden, so that applications can have sufficient memory to run. Consider
-using a delayed message
- to release resources if the IME is in a hidden state for a few seconds.
+ Conversely, you should release large memory allocations soon after the input method window is
+ hidden, so that applications can have sufficient memory to run. Consider using a delayed
+ message to release resources if the IME is in a hidden state for a few seconds.
</li>
<li>
- Make sure that users can enter as many characters as possible for the
-language or locale
- associated with the IME. Remember that users may use punctuation in
-passwords or user
- names, so your IME has to provide many different characters to allow users
-to enter a
+ Make sure that users can enter as many characters as possible for the language or locale
+ associated with the IME. Remember that users may use punctuation in passwords or user
+ names, so your IME has to provide many different characters to allow users to enter a
password and get access to the device.
</li>
</ul> \ No newline at end of file