Home | History | Annotate | Download | only in gcm
      1 page.title=Getting Started on Android
      2 page.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 Google Cloud Messaging
     29 (GCM) implementation.
     30 Before you begin, make sure to <a href="/google/play-services/setup.html">set up
     31 the Google Play Services SDK</a>. You need this SDK to use the
     32 <a href="{@docRoot}reference/com/google/android/gms/gcm/package-summary.html">
     33 GCM APIs</a>.</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
     45 project 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
     69 purposes, 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>.
     74 You will need the API key later on to perform authentication in your app 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
     78 compromised 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
     84 implementing GCM. Here is an overview of the basic steps:</p>
     85 
     86 <ol>
     87   <li>Implement an app server (the "3rd-party app server") to interact
     88 with your chosen GCM connection server. The app server sends data to a
     89 GCM-enabled Android client app via the GCM connection server. For more
     90 information about implementing the server side, see <a href="server.html">
     91 Implementing GCM Server</a>.</li>
     92 <li>Write your client app. This is the GCM-enabled Android app that runs
     93 on a device. See <a href="client.html">Implementing GCM Client</a> for more information.</li>
     94 </ol>
     95