Katie McCormick | 0ab9326 | 2013-11-01 18:10:51 -0700 | [diff] [blame] | 1 | page.title=Getting Started |
Scott Main | 6afeb0e | 2013-04-16 21:05:51 -0700 | [diff] [blame] | 2 | page.tags="cloud","push","messaging" |
Katie McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 3 | @jd:body |
| 4 | |
| 5 | <div id="qv-wrapper"> |
| 6 | <div id="qv"> |
| 7 | |
Katie McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 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> |
Katie McCormick | 0ab9326 | 2013-11-01 18:10:51 -0700 | [diff] [blame] | 15 | <li><a href="#next">Next Steps</a></li> |
kmccormick | eeaac81 | 2013-04-18 10:57:59 -0700 | [diff] [blame] | 16 | </ol> |
| 17 | |
| 18 | <h2>See Also</h2> |
| 19 | |
| 20 | <ol class="toc"> |
Katie McCormick | 6b37262 | 2013-11-15 16:02:58 -0800 | [diff] [blame] | 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> |
kmccormick | eeaac81 | 2013-04-18 10:57:59 -0700 | [diff] [blame] | 23 | <li><a href="https://services.google.com/fb/forms/gcm/" class="external-link" target="_android">CCS and User Notifications Signup Form</a></li> |
Katie McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 24 | </ol> |
| 25 | |
| 26 | </div> |
| 27 | </div> |
| 28 | |
Katie McCormick | 0ab9326 | 2013-11-01 18:10:51 -0700 | [diff] [blame] | 29 | <p>This document tells you how to get started setting up a GCM |
kmccormick | eeaac81 | 2013-04-18 10:57:59 -0700 | [diff] [blame] | 30 | implementation. |
Katie McCormick | 0ab9326 | 2013-11-01 18:10:51 -0700 | [diff] [blame] | 31 | Before you begin, make sure to <a href="/google/play-services/setup.html">set up |
| 32 | the 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 McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 35 | |
Katie McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 36 | <h2 id="create-proj">Creating a Google API project</h2> |
| 37 | <p>To create a Google API project:</p> |
| 38 | <ol> |
Katie McCormick | 5719ee1 | 2013-12-10 16:08:16 -0800 | [diff] [blame] | 39 | <li>Open the <a href="https://cloud.google.com/console">Google Developers Console</a>. |
Katie McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 40 | </li> |
Katie McCormick | 6b37262 | 2013-11-15 16:02:58 -0800 | [diff] [blame] | 41 | <li>If you haven't created an API project yet, click <strong>Create Project</strong>.</li> |
Katie McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 42 | |
Katie McCormick | 6b37262 | 2013-11-15 16:02:58 -0800 | [diff] [blame] | 43 | <li>Supply a project name and click <strong>Create</strong>. |
Katie McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 44 | |
Katie McCormick | 6b37262 | 2013-11-15 16:02:58 -0800 | [diff] [blame] | 45 | <p>Once the project has been created, a page appears that displays your project ID and |
| 46 | project 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 McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 50 | |
| 51 | </ol> |
| 52 | <h2 id="gcm-service">Enabling the GCM Service</h2> |
| 53 | <p>To enable the GCM service:</p> |
| 54 | <ol> |
Katie McCormick | 6b37262 | 2013-11-15 16:02:58 -0800 | [diff] [blame] | 55 | <li>In the sidebar on the left, select <strong>APIs & 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 McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 59 | </ol> |
| 60 | <h2 id="access-key">Obtaining an API Key</h2> |
| 61 | <p>To obtain an API key:</p> |
| 62 | <ol> |
Katie McCormick | 5719ee1 | 2013-12-10 16:08:16 -0800 | [diff] [blame] | 63 | <li>In the sidebar on the left, select <strong>APIs & auth > Credentials</strong>.</li> |
Katie McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 64 | |
Katie McCormick | 5719ee1 | 2013-12-10 16:08:16 -0800 | [diff] [blame] | 65 | <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 |
| 70 | the 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 McCormick | 6b37262 | 2013-11-15 16:02:58 -0800 | [diff] [blame] | 73 | <a href="http://developers.google.com/console/help/new/#installedapplications">console |
Katie McCormick | 5719ee1 | 2013-12-10 16:08:16 -0800 | [diff] [blame] | 74 | help</a>.</p></li> |
| 75 | <li>Click <strong>Create</strong>.</li> |
kmccormick | eeaac81 | 2013-04-18 10:57:59 -0700 | [diff] [blame] | 76 | |
Katie McCormick | 5719ee1 | 2013-12-10 16:08:16 -0800 | [diff] [blame] | 77 | <li>In the refreshed page, copy the |
Katie McCormick | 6b37262 | 2013-11-15 16:02:58 -0800 | [diff] [blame] | 78 | <a href="{@docRoot}google/gcm/gcm.html#apikey">API key</a>. |
| 79 | You will need the API key later on to perform authentication in your application server.</li> |
Katie McCormick | 0ab9326 | 2013-11-01 18:10:51 -0700 | [diff] [blame] | 80 | |
Katie McCormick | 0ab9326 | 2013-11-01 18:10:51 -0700 | [diff] [blame] | 81 | <p class="note"><strong>Note:</strong> If you need to rotate the key, click |
Katie McCormick | 5719ee1 | 2013-12-10 16:08:16 -0800 | [diff] [blame] | 82 | <strong>Regenerate key</strong>. A new key will be created. If you think the key has been |
| 83 | compromised and you want to delete it immediately, click <strong>Delete</strong>.</p> |
Katie McCormick | 6b37262 | 2013-11-15 16:02:58 -0800 | [diff] [blame] | 84 | </ol> |
Katie McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 85 | |
Katie McCormick | 0ab9326 | 2013-11-01 18:10:51 -0700 | [diff] [blame] | 86 | <h2 id="next">Next Steps</h2> |
Katie McCormick | 60c8f99 | 2012-07-12 11:57:36 -0700 | [diff] [blame] | 87 | |
Katie McCormick | 0ab9326 | 2013-11-01 18:10:51 -0700 | [diff] [blame] | 88 | <p>Once you've finished the tasks listed above, you're ready to start |
| 89 | implementing GCM. Here is an overview of the basic steps:</p> |
Katie McCormick | 76c6d86 | 2012-06-25 09:56:29 -0700 | [diff] [blame] | 90 | |
Katie McCormick | 0ab9326 | 2013-11-01 18:10:51 -0700 | [diff] [blame] | 91 | <ol> |
| 92 | <li>Decide which Google-provided GCM connection server you want to use— |
| 93 | <a href="http.html">HTTP</a> or <a href="ccs.html">XMPP</a> (CCS). GCM connection servers |
| 94 | take messages from a 3rd-party application |
| 95 | server (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 |
| 98 | with your chosen GCM connection server. The app server sends data to a |
| 99 | GCM-enabled Android client application via the GCM connection server. For more |
| 100 | information about implementing the server side, see <a href="server.html"> |
| 101 | Implementing GCM Server</a>.</li> |
| 102 | <li>Write your client app. This is the GCM-enabled Android application that runs |
| 103 | on a device. See <a href="client.html">Implementing GCM Client</a> for more information.</li> |
| 104 | </ol> |
kmccormick | f788ac1 | 2013-05-30 19:06:41 -0700 | [diff] [blame] | 105 | |