blob: a88962462cfc7aad71838f0b3d11c599388093e3 [file] [log] [blame]
page.title=Getting Started
page.tags=cloud,push,messaging
@jd:body
<div id="qv-wrapper">
<div id="qv">
<h2>In this document</h2>
<ol class="toc">
<li><a href="#create-proj">Creating a Google API Project</a></li>
<li><a href="#gcm-service">Enabling the GCM Service</a></li>
<li><a href="#access-key">Obtaining an API Key</a></li>
<li><a href="#next">Next Steps</a></li>
</ol>
<h2>See Also</h2>
<ol class="toc">
<li><a href="https://cloud.google.com/console">Google Cloud Console</a></li>
<li><a href="https://developers.google.com/console/help/new/">Google Cloud Console Help</a></li>
</ol>
</div>
</div>
<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/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>
<ol>
<li>Open the <a href="https://cloud.google.com/console">Google Developers Console</a>.
</li>
<li>If you haven't created an API project yet, click <strong>Create Project</strong>.</li>
<li>Supply a project name and click <strong>Create</strong>.
<p>Once the project has been created, a page appears that displays your project ID and
project number. For example, <strong>Project Number: 670330094152</strong>.</p></li>
<li>Copy down your project number. You will use it later on as the
<a href="{@docRoot}google/gcm/gcm.html#senderid">GCM sender ID</a>.</li>
</ol>
<h2 id="gcm-service">Enabling the GCM Service</h2>
<p>To enable the GCM service:</p>
<ol>
<li>In the sidebar on the left, select <strong>APIs &amp; auth</strong>. </li>
<li>In the displayed list of APIs, turn the <strong>Google Cloud Messaging for Android
</strong> toggle to ON.</li>
</ol>
<h2 id="access-key">Obtaining an API Key</h2>
<p>To obtain an API key:</p>
<ol>
<li>In the sidebar on the left, select <strong>APIs &amp; auth > Credentials</strong>.</li>
<li>Under <strong>Public API access</strong>, click <strong>Create new key</strong>.</li>
<li>In the <strong>Create a new key</strong> dialog, click <strong>Server key</strong>.</li>
<li>In the resulting configuration dialog, supply your server's IP address. For testing
purposes, you can use {@code 0.0.0.0/0}.</p></li>
<li>Click <strong>Create</strong>.</li>
<li>In the refreshed page, copy the
<a href="{@docRoot}google/gcm/gcm.html#apikey">API key</a>.
You will need the API key later on to perform authentication in your application server.</li>
<p class="note"><strong>Note:</strong> If you need to rotate the key, click
<strong>Regenerate key</strong>. A new key will be created. If you think the key has been
compromised and you want to delete it immediately, click <strong>Delete</strong>.</p>
</ol>
<h2 id="next">Next Steps</h2>
<p>Once you've finished the tasks listed above, you're ready to start
implementing GCM. Here is an overview of the basic steps:</p>
<ol>
<li>Decide which Google-provided GCM connection server you want to use&mdash;
<a href="http.html">HTTP</a> or <a href="ccs.html">XMPP</a> (CCS). GCM connection servers
take messages from a 3rd-party application
server (written by you) and send them to a GCM-enabled Android application (the
"client app," also written by you) running on a device. </li>
<li>Implement an application server (the "3rd-party application server") to interact
with your chosen GCM connection server. The app server sends data to a
GCM-enabled Android client application via the GCM connection server. For more
information about implementing the server side, see <a href="server.html">
Implementing GCM Server</a>.</li>
<li>Write your client app. This is the GCM-enabled Android application that runs
on a device. See <a href="client.html">Implementing GCM Client</a> for more information.</li>
</ol>