blob: 8bc19361d69661630ada8f1499d612bffec4a600 [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
67<li>In the <strong>Create a new key</strong> dialog, click <strong>Android key</strong>.</li>
68
69<li>In the resulting configuration dialog, supply one SHA1 fingerprint and
70the package name for your app, separated by a semicolon. For example,
71{@code 45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:12:17:F2:56:26:A0:E0;com.myexample}.
72<p>To get the value for the SHA1 fingerprint, follow the instructions in the
Katie McCormick6b372622013-11-15 16:02:58 -080073<a href="http://developers.google.com/console/help/new/#installedapplications">console
Katie McCormick5719ee12013-12-10 16:08:16 -080074help</a>.</p></li>
75<li>Click <strong>Create</strong>.</li>
kmccormickeeaac812013-04-18 10:57:59 -070076
Katie McCormick5719ee12013-12-10 16:08:16 -080077<li>In the refreshed page, copy the
Katie McCormick6b372622013-11-15 16:02:58 -080078<a href="{@docRoot}google/gcm/gcm.html#apikey">API key</a>.
79You will need the API key later on to perform authentication in your application server.</li>
Katie McCormick0ab93262013-11-01 18:10:51 -070080
Katie McCormick0ab93262013-11-01 18:10:51 -070081<p class="note"><strong>Note:</strong> If you need to rotate the key, click
Katie McCormick5719ee12013-12-10 16:08:16 -080082<strong>Regenerate key</strong>. A new key will be created. If you think the key has been
83compromised and you want to delete it immediately, click <strong>Delete</strong>.</p>
Katie McCormick6b372622013-11-15 16:02:58 -080084</ol>
Katie McCormick76c6d862012-06-25 09:56:29 -070085
Katie McCormick0ab93262013-11-01 18:10:51 -070086<h2 id="next">Next Steps</h2>
Katie McCormick60c8f992012-07-12 11:57:36 -070087
Katie McCormick0ab93262013-11-01 18:10:51 -070088<p>Once you've finished the tasks listed above, you're ready to start
89implementing GCM. Here is an overview of the basic steps:</p>
Katie McCormick76c6d862012-06-25 09:56:29 -070090
Katie McCormick0ab93262013-11-01 18:10:51 -070091<ol>
92 <li>Decide which Google-provided GCM connection server you want to use&mdash;
93 <a href="http.html">HTTP</a> or <a href="ccs.html">XMPP</a> (CCS). GCM connection servers
94take messages from a 3rd-party application
95server (written by you) and send them to a GCM-enabled Android application (the
96"client app," also written by you) running on a device. </li>
97 <li>Implement an application server (the "3rd-party application server") to interact
98with your chosen GCM connection server. The app server sends data to a
99GCM-enabled Android client application via the GCM connection server. For more
100information about implementing the server side, see <a href="server.html">
101Implementing GCM Server</a>.</li>
102<li>Write your client app. This is the GCM-enabled Android application that runs
103on a device. See <a href="client.html">Implementing GCM Client</a> for more information.</li>
104</ol>
kmccormickf788ac12013-05-30 19:06:41 -0700105