• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Getting Started
2page.tags=cloud,push,messaging
3@jd:body
4
5<div id="qv-wrapper">
6<div id="qv">
7
8
9<h2>In this document</h2>
10
11<ol class="toc">
12<li><a href="#create-proj">Creating a Google API Project</a></li>
13<li><a href="#gcm-service">Enabling the GCM Service</a></li>
14<li><a href="#access-key">Obtaining an API Key</a></li>
15<li><a href="#next">Next Steps</a></li>
16</ol>
17
18<h2>See Also</h2>
19
20<ol class="toc">
21<li><a href="https://cloud.google.com/console">Google Cloud Console</a></li>
22<li><a href="https://developers.google.com/console/help/new/">Google Cloud Console Help</a></li>
23</ol>
24
25</div>
26</div>
27
28<p>This document tells you how to get started setting up a GCM
29implementation.
30Before you begin, make sure to <a href="/google/play-services/setup.html">set up
31the Google Play Services SDK</a>. You need this SDK to use the
32<a href="{@docRoot}reference/com/google/android/gms/gcm/GoogleCloudMessaging.html">
33{@code GoogleCloudMessaging}</a> methods.</p>
34
35<h2 id="create-proj">Creating a Google API project</h2>
36<p>To create a Google API project:</p>
37<ol>
38  <li>Open the <a href="https://cloud.google.com/console">Google Developers Console</a>.
39  </li>
40  <li>If you haven't created an API project yet, click <strong>Create Project</strong>.</li>
41
42 <li>Supply a project name and click <strong>Create</strong>.
43
44<p>Once the project has been created, a page appears that displays your project ID and
45project number. For example, <strong>Project Number: 670330094152</strong>.</p></li>
46
47  <li>Copy down your project number. You will use it later on as the
48  <a href="{@docRoot}google/gcm/gcm.html#senderid">GCM sender ID</a>.</li>
49
50</ol>
51<h2 id="gcm-service">Enabling the GCM Service</h2>
52<p>To enable the GCM service:</p>
53<ol>
54  <li>In the sidebar on the left, select <strong>APIs &amp; auth</strong>. </li>
55  <li>In the displayed list of APIs, turn the <strong>Google Cloud Messaging for Android
56  </strong> toggle to ON.</li>
57
58</ol>
59<h2 id="access-key">Obtaining an API Key</h2>
60<p>To obtain an API  key:</p>
61<ol>
62 <li>In the sidebar on the left, select <strong>APIs &amp; auth > Credentials</strong>.</li>
63
64 <li>Under <strong>Public API access</strong>, click <strong>Create new key</strong>.</li>
65
66<li>In the <strong>Create a new key</strong> dialog, click <strong>Server key</strong>.</li>
67
68<li>In the resulting configuration dialog, supply your server's IP address. For testing
69purposes, you can use {@code 0.0.0.0/0}.</p></li>
70<li>Click <strong>Create</strong>.</li>
71
72<li>In the refreshed page, copy the
73<a href="{@docRoot}google/gcm/gcm.html#apikey">API key</a>.
74You will need the API key later on to perform authentication in your application server.</li>
75
76<p class="note"><strong>Note:</strong> If you need to rotate the key, click
77<strong>Regenerate key</strong>. A new key  will be created. If you think the key has been
78compromised and you want to delete it immediately, click <strong>Delete</strong>.</p>
79</ol>
80
81<h2 id="next">Next Steps</h2>
82
83<p>Once you've finished the tasks listed above, you're ready to start
84implementing GCM. Here is an overview of the basic steps:</p>
85
86<ol>
87  <li>Decide which Google-provided GCM connection server you want to use&mdash;
88  <a href="http.html">HTTP</a> or <a href="ccs.html">XMPP</a> (CCS). GCM connection servers
89take messages from a 3rd-party application
90server (written by you) and send them to a GCM-enabled Android application (the
91"client app," also written by you) running on a device. </li>
92  <li>Implement an application server (the "3rd-party application server") to interact
93with your chosen GCM connection server. The app server sends data to a
94GCM-enabled Android client application via the GCM connection server. For more
95information about implementing the server side, see <a href="server.html">
96Implementing GCM Server</a>.</li>
97<li>Write your client app. This is the GCM-enabled Android application that runs
98on a device. See <a href="client.html">Implementing GCM Client</a> for more information.</li>
99</ol>
100