Lines Matching full:application
11 <li>Learn the basic features of a GCM application.</li>
12 <li>Understand the role of the 3rd-party application server, and how to send messages and process results.</li>
31 <li><a href="#server">Role of the 3rd-party Application Server</a>
52 This could be a lightweight message telling the Android application
57 Android application running on the target device.</p>
76 <li>It allows 3rd-party application servers to send messages to
79 <li>An Android application on an Android device doesn't need to be running to receive
80 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
84 Android application, which has full control of how to handle it. For example, the
85 application might post a notification, display a custom user interface, or
88 Google Play Store application installed, or or an emulator running Android 2.2 with Google APIs. However, you are not limited to deploying your
111 <td width="1176">The device that is running an Android application that uses
116 <td><strong>3rd-party Application Server</strong></td>
117 <td>An application server that developers set up as part of implementing
118 GCM in their applications. The 3rd-party application server sends data to an
119 Android application on the device via the GCM server.</td>
124 application server and sending them to the device. </td>
133 Android application that is permitted to send messages to the device.</td>
136 <td><strong>Application ID</strong></td>
137 <td>The Android application that is registering to receive messages. The Android application
139 This ensures that the messages are targeted to the correct Android application.</td>
143 <td>An ID issued by the GCM servers to the Android application that allows
144 it to receive messages. Once the Android application has the registration ID, it sends
145 it to the 3rd-party application server, which uses it to identify each device
146 that has registered to receive messages for a given Android application. In other words,
147 a registration ID is tied to a particular Android application running on a particular
165 <td>An API key that is saved on the 3rd-party application
166 server that gives the application server authorized access to Google services.
185 <li><a href="#register">Enable GCM</a>. An Android application running on a
189 <li><a href="#push-process">Send a message</a>. A 3rd-party application
191 <li><a href="#receiving">Receive a message</a>. An Android application
199 <p>This is the sequence of events that occurs when an Android application
204 <li>The first time the Android application needs to use the messaging service, it
207 (<code>com.google.android.c2dm.intent.REGISTER</code>) includes the sender ID, and the Android application ID.</p>
208 <p class="note"><strong>Note:</strong> Because there is no lifecycle method that is called when the application is run for
209 the first time, the registration intent should be sent on <code>onCreate()</code>, but only if the application is not registered yet.
212 <li>If the registration is successful, the GCM server broadcasts a <code>com.google.android.c2dm.intent.REGISTRATION</code> intent which gives the Android application a registration
214 <p>The Android application should store this ID for later use (for instance, to check on <code>onCreate()</code> if it is already registered).
215 Note that Google may periodically refresh the registration ID, so you should design your Android application
217 multiple times. Your Android application needs to be able to respond
219 <li>To complete the registration, the Android application sends the registration ID to
220 the application server. The application server typically stores the registration
224 <p>The registration ID lasts until the Android application explicitly unregisters
225 itself, or until Google refreshes the registration ID for your Android application.</p>
227 <p class="note"><strong>Note:</strong> When users uninstall an application, it is not automatically unregistered on GCM. It is only unregistered when the GCM server tries to send a message to the device and the device answers that the application is uninstalled or it does not have a broadcast receiver configured to receive <code>com.google.android.c2dm.intent.RECEIVE</code> intents. At that point, your server should mark the device as unregistered (the server will receive a <code><a href="#unreg_device">NotRegistered</a></code> error).</p>
236 <p>For an application server to send a message to an Android application, the following things must be in
240 <li>The Android application has stored a target that it can specify as the recipient of a message. This can be one of the following:
249 set up on the application server for the Android application (for more discussion, see
250 <a href="#server">Role of the 3rd-party Application Server</a>). Now it will
254 <p>Here is the sequence of events that occurs when the application server sends a
258 <li>The application server sends a message to GCM servers.</li>
263 Android application via Intent broadcast with proper permissions, so that only the
264 targeted Android application gets the message. This wakes the Android application up. The
265 Android application does not need to be running beforehand to receive the message.</li>
266 <li>The Android application processes the message. If the Android application is doing
270 <p> An Android application can unregister GCM if it no longer wants to receive
275 <p>This is the sequence of events that occurs when an Android application
281 <li>The system passes the key/value pairs to the targeted Android application
284 <li>The Android application extracts the raw data
290 <p>When mobile device users install Android applications that include GCM, the Google Play Store will inform them that the Android application
292 Android application. </p>
295 <h2 id="server">Role of the 3rd-party Application Server</h2>
298 have an application server that meets the following criteria:</p>
310 <p>This section describes how the 3rd-party application server sends messages to one or more mobile devices. Note the following:</p>
312 <li>A 3rd-party application server can either send messages to a single device or to multiple devices. A message sent to multiple devices simultaneously is called a <em>multicast message</em>.</li>
318 <p>Before the 3rd-party application server can send a message to an
319 Android application, it must have received a registration ID from it.</p>
321 <p>To send a message, the application server issues a POST request to <code>https://android.googleapis.com/gcm/send</code>.</p>
327 <li><code>Content-Type</code>: <code>application/json</code> for JSON; <code>application/x-www-form-urlencoded;charset=UTF-8</code> for plain text.
333 <pre>Content-Type:application/json
374 message sent by the application server. See <a href="adv.html#collapsible">Advanced Topics</a> for more discussion of this topic. Optional.</td>
379 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>.
398 <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.
521 <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 response. Application servers must implement exponential back-off. <a href="#internal_error">Troubleshoot</a></td>
569 <li>If it is <code>NotRegistered</code>, you should remove the registration ID from your server database because the application was uninstalled from the device or it does not have a broadcast receiver configured to receive <code>com.google.android.c2dm.intent.RECEIVE</code> intents.</li>
605 <dd>A registration ID is tied to a certain group of senders. When an application registers for GCM usage, it must specify which senders are allowed to send messages. Make sure you're using one of those when trying to send messages to the device. If you switch to a different sender, the existing registration IDs won't work.
611 <li>If the application manually unregisters by issuing a <span class="prettyprint pretty-java"><code>com.google.android.c2dm.intent.UNREGISTER</code></span><code> </code>intent.</li>
612 <li>If the application is automatically unregistered, which can happen (but is not guaranteed) if the user uninstalls the application.</li>
614 <li>If the application is updated but the new version does not have a broadcast receiver configured to receive <code>com.google.android.c2dm.intent.RECEIVE</code> intents.</li>
645 # curl --header "Authorization: key=$api_key" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"ABC\"]}"</pre>
739 <li>Sixth message: registration ID (42) should be removed from the server database because the application was uninstalled from the device.</li>