blob: d937955d300430fce17cfe38bd186cb2a43aeabf [file] [log] [blame]
Katie McCormick0ab93262013-11-01 18:10:51 -07001page.title=Getting Started
Scott Main6afeb0e2013-04-16 21:05:51 -07002page.tags="cloud","push","messaging"
Katie McCormick76c6d862012-06-25 09:56:29 -07003@jd:body
4
5<div id="qv-wrapper">
6<div id="qv">
7
Katie McCormick76c6d862012-06-25 09:56:29 -07008
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>
Katie McCormick0ab93262013-11-01 18:10:51 -070015<li><a href="#next">Next Steps</a></li>
kmccormickeeaac812013-04-18 10:57:59 -070016</ol>
17
18<h2>See Also</h2>
19
20<ol class="toc">
Katie McCormick6b372622013-11-15 16:02:58 -080021<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>
kmccormickeeaac812013-04-18 10:57:59 -070023<li><a href="https://services.google.com/fb/forms/gcm/" class="external-link" target="_android">CCS and User Notifications Signup Form</a></li>
Katie McCormick76c6d862012-06-25 09:56:29 -070024</ol>
25
26</div>
27</div>
28
Katie McCormick0ab93262013-11-01 18:10:51 -070029<p>This document tells you how to get started setting up a GCM
kmccormickeeaac812013-04-18 10:57:59 -070030implementation.
Katie McCormick0ab93262013-11-01 18:10:51 -070031Before you begin, make sure to <a href="/google/play-services/setup.html">set up
32the Google Play Services SDK</a>. You need this SDK to use the
33<a href="{@docRoot}reference/com/google/android/gms/gcm/GoogleCloudMessaging.html">
34{@code GoogleCloudMessaging}</a> methods.</p>
Katie McCormick76c6d862012-06-25 09:56:29 -070035
Katie McCormick76c6d862012-06-25 09:56:29 -070036<h2 id="create-proj">Creating a Google API project</h2>
37<p>To create a Google API project:</p>
38<ol>
Katie McCormick5719ee12013-12-10 16:08:16 -080039 <li>Open the <a href="https://cloud.google.com/console">Google Developers Console</a>.
Katie McCormick76c6d862012-06-25 09:56:29 -070040 </li>
Katie McCormick6b372622013-11-15 16:02:58 -080041 <li>If you haven't created an API project yet, click <strong>Create Project</strong>.</li>
Katie McCormick76c6d862012-06-25 09:56:29 -070042
Katie McCormick6b372622013-11-15 16:02:58 -080043 <li>Supply a project name and click <strong>Create</strong>.
Katie McCormick76c6d862012-06-25 09:56:29 -070044
Katie McCormick6b372622013-11-15 16:02:58 -080045<p>Once the project has been created, a page appears that displays your project ID and
46project number. For example, <strong>Project Number: 670330094152</strong>.</p></li>
47
48 <li>Copy down your project number. You will use it later on as the
49 <a href="{@docRoot}google/gcm/gcm.html#senderid">GCM sender ID</a>.</li>
Katie McCormick76c6d862012-06-25 09:56:29 -070050
51</ol>
52<h2 id="gcm-service">Enabling the GCM Service</h2>
53<p>To enable the GCM service:</p>
54<ol>
Katie McCormick6b372622013-11-15 16:02:58 -080055 <li>In the sidebar on the left, select <strong>APIs &amp; auth</strong>. </li>
56 <li>In the displayed list of APIs, turn the <strong>Google Cloud Messaging for Android
57 </strong> toggle to ON.</li>
58
Katie McCormick76c6d862012-06-25 09:56:29 -070059</ol>
60<h2 id="access-key">Obtaining an API Key</h2>
61<p>To obtain an API key:</p>
62<ol>
Katie McCormick5719ee12013-12-10 16:08:16 -080063 <li>In the sidebar on the left, select <strong>APIs &amp; auth > Credentials</strong>.</li>
Katie McCormick76c6d862012-06-25 09:56:29 -070064
Katie McCormick5719ee12013-12-10 16:08:16 -080065 <li>Under <strong>Public API access</strong>, click <strong>Create new key</strong>.</li>
66
Katie McCormick63b2b8c2014-02-07 17:36:03 -080067<li>In the <strong>Create a new key</strong> dialog, click <strong>Server key</strong>.</li>
Katie McCormick5719ee12013-12-10 16:08:16 -080068
Katie McCormick63b2b8c2014-02-07 17:36:03 -080069<li>In the resulting configuration dialog, supply your server's IP address. For testing
70purposes, you can use {@code 0.0.0.0/0}.</p></li>
Katie McCormick5719ee12013-12-10 16:08:16 -080071<li>Click <strong>Create</strong>.</li>
kmccormickeeaac812013-04-18 10:57:59 -070072
Katie McCormick5719ee12013-12-10 16:08:16 -080073<li>In the refreshed page, copy the
Katie McCormick6b372622013-11-15 16:02:58 -080074<a href="{@docRoot}google/gcm/gcm.html#apikey">API key</a>.
75You will need the API key later on to perform authentication in your application server.</li>
Katie McCormick0ab93262013-11-01 18:10:51 -070076
Katie McCormick0ab93262013-11-01 18:10:51 -070077<p class="note"><strong>Note:</strong> If you need to rotate the key, click
Katie McCormick5719ee12013-12-10 16:08:16 -080078<strong>Regenerate key</strong>. A new key will be created. If you think the key has been
79compromised and you want to delete it immediately, click <strong>Delete</strong>.</p>
Katie McCormick6b372622013-11-15 16:02:58 -080080</ol>
Katie McCormick76c6d862012-06-25 09:56:29 -070081
Katie McCormick0ab93262013-11-01 18:10:51 -070082<h2 id="next">Next Steps</h2>
Katie McCormick60c8f992012-07-12 11:57:36 -070083
Katie McCormick0ab93262013-11-01 18:10:51 -070084<p>Once you've finished the tasks listed above, you're ready to start
85implementing GCM. Here is an overview of the basic steps:</p>
Katie McCormick76c6d862012-06-25 09:56:29 -070086
Katie McCormick0ab93262013-11-01 18:10:51 -070087<ol>
88 <li>Decide which Google-provided GCM connection server you want to use&mdash;
89 <a href="http.html">HTTP</a> or <a href="ccs.html">XMPP</a> (CCS). GCM connection servers
90take messages from a 3rd-party application
91server (written by you) and send them to a GCM-enabled Android application (the
92"client app," also written by you) running on a device. </li>
93 <li>Implement an application server (the "3rd-party application server") to interact
94with your chosen GCM connection server. The app server sends data to a
95GCM-enabled Android client application via the GCM connection server. For more
96information about implementing the server side, see <a href="server.html">
97Implementing GCM Server</a>.</li>
98<li>Write your client app. This is the GCM-enabled Android application that runs
99on a device. See <a href="client.html">Implementing GCM Client</a> for more information.</li>
100</ol>