blob: 85873a68971acb0b5770cb5bdec5827f71bcb269 [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registering with a notification service &mdash; Apache Usergrid 2.x documentation</title>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="top" title="Apache Usergrid 2.x documentation" href="../index.html"/>
<link rel="next" title="Creating notifiers" href="creating-notifiers.html"/>
<link rel="prev" title="Tutorial: Push notifications sample app" href="tutorial.html"/>
<script src="../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-nav-search">
<a href="../index.html" class="icon icon-home"> Apache Usergrid
</a>
<div class="version">
2.x
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Getting Started</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../introduction/overview.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/usergrid-features.html">Usergrid Features</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/data-model.html">Usergrid Data model</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/async-vs-sync.html">Async vs. sync calls</a></li>
</ul>
<p class="caption"><span class="caption-text">Using Usergrid</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/creating-account.html">Creating a Usergrid Account</a></li>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/creating-a-new-application.html">Creating a new application</a></li>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/using-a-sandbox-app.html">Using a Sandbox Application</a></li>
<li class="toctree-l1"><a class="reference internal" href="../using-usergrid/using-the-api.html">Using the API</a></li>
</ul>
<p class="caption"><span class="caption-text">Data Storage</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/data-store-dbms.html">The Usergrid Data Store</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/optimizing-access.html">Data Store Best Practices</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/collections.html">Collections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-storage/entities.html">Entities</a></li>
</ul>
<p class="caption"><span class="caption-text">Data Queries</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/querying-your-data.html">Querying your data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/query-parameters.html">Query parameters &amp; clauses</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/operators-and-types.html">Query operators &amp; data types</a></li>
<li class="toctree-l1"><a class="reference internal" href="../data-queries/advanced-query-usage.html">Advanced query usage</a></li>
</ul>
<p class="caption"><span class="caption-text">Entity Connections</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../entity-connections/connecting-entities.html">Connecting entities</a></li>
<li class="toctree-l1"><a class="reference internal" href="../entity-connections/retrieving-entities.html">Retrieving connections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../entity-connections/disconnecting-entities.html">Disconnecting entities</a></li>
</ul>
<p class="caption"><span class="caption-text">Push Notifications</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="overview.html">Push notifications overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="adding-push-support.html">Adding push notifications support</a></li>
<li class="toctree-l1"><a class="reference internal" href="getting-started.html">Getting started with push notifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="tutorial.html">Tutorial: Push notifications sample app</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Registering with a notification service</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#registering-with-apple-apns">Registering with Apple APNs</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#generating-an-ssl-signing-certificate">Generating an SSL signing certificate</a></li>
<li class="toctree-l3"><a class="reference internal" href="#creating-an-app-id">Creating an App ID</a></li>
<li class="toctree-l3"><a class="reference internal" href="#generating-a-p12-certificate">Generating a .p12 certificate</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#registering-with-google-gcm">Registering with Google GCM</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="creating-notifiers.html">Creating notifiers</a></li>
<li class="toctree-l1"><a class="reference internal" href="managing-users-and-devices.html">Managing users and devices</a></li>
<li class="toctree-l1"><a class="reference internal" href="creating-and-managing-notifications.html">Creating and managing notifications</a></li>
<li class="toctree-l1"><a class="reference internal" href="troubleshooting.html">Troubleshooting</a></li>
</ul>
<p class="caption"><span class="caption-text">Security &amp; Authentication</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/app-security.html">Security &amp; token authentication</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-permissions.html">Using permissions</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/using-roles.html">Using roles</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-users-and-application-clients.html">Authenticating users &amp; app clients</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/user-authentication-types.html">Authentication levels</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/changing-token-time-live-ttl.html">Changing token expiration (time-to-live)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/authenticating-api-requests.html">Authenticating API requests</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/revoking-tokens-logout.html">Revoking tokens (logout)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/facebook-sign.html">Facebook sign in</a></li>
<li class="toctree-l1"><a class="reference internal" href="../security-and-auth/securing-your-app.html">Security best practices</a></li>
</ul>
<p class="caption"><span class="caption-text">User Management &amp; Social Graph</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../user-management/user-management.html">User management &amp; social graph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/working-user-data.html">Working with User Data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/group.html">Working with group data</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/activity.html">Activity</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html">Social Graph Connections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/user-connections.html#creating-other-connections">Creating other connections</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user-management/messagee-example.html">App Example - Messagee</a></li>
</ul>
<p class="caption"><span class="caption-text">Geo-location</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../geolocation/geolocation.html">Geolocating your Entities</a></li>
</ul>
<p class="caption"><span class="caption-text">Assets &amp; Files</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../assets-and-files/uploading-assets.html">Uploading assets</a></li>
<li class="toctree-l1"><a class="reference internal" href="../assets-and-files/retrieving-assets.html">Retrieving assets</a></li>
<li class="toctree-l1"><a class="reference internal" href="../assets-and-files/folders.html">Folders</a></li>
</ul>
<p class="caption"><span class="caption-text">Counters &amp; Events</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/events-and-counters.html">Counters &amp; events</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html">Creating &amp; incrementing counters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#decrementing-resetting-counters">Decrementing/resetting counters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/creating-and-incrementing-counters.html#using-counters-hierarchically">Using counters hierarchically</a></li>
<li class="toctree-l1"><a class="reference internal" href="../counters-and-events/retrieving-counters.html">Retrieving counters</a></li>
</ul>
<p class="caption"><span class="caption-text">Organizations &amp; Applications</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/managing.html">Organization &amp; application management</a></li>
<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/organization.html">Organization</a></li>
<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/application.html">Application</a></li>
<li class="toctree-l1"><a class="reference internal" href="../orgs-and-apps/admin-user.html">Admin user</a></li>
</ul>
<p class="caption"><span class="caption-text">API Reference</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html">Methods</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#models">Models</a></li>
<li class="toctree-l1"><a class="reference internal" href="../rest-endpoints/api-docs.html#sub-types">Sub-Types</a></li>
</ul>
<p class="caption"><span class="caption-text">Client SDKs</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../sdks/tbd.html">COMING SOON...</a></li>
</ul>
<p class="caption"><span class="caption-text">Installing Usergrid</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../installation/deployment-guide.html">Usergrid 2.1.0 Deployment Guide</a></li>
</ul>
<p class="caption"><span class="caption-text">More about Usergrid</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../reference/presos-and-videos.html">Presentations &amp; Videos</a></li>
<li class="toctree-l1"><a class="reference internal" href="../reference/contribute-code.html">How to Contribute Code &amp; Docs</a></li>
</ul>
</div>
&nbsp;
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">Apache Usergrid</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> &raquo;</li>
<li>Registering with a notification service</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/push-notifications/registering.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="registering-with-a-notification-service">
<h1>Registering with a notification service<a class="headerlink" href="#registering-with-a-notification-service" title="Permalink to this headline"></a></h1>
<p>To send push notifications, you will need to first register your app
with the push notification service (Apple APNs or Google GCM) that
corresponds to your app&#8217;s platform. Once you&#8217;ve registered, the service
will provide you with a certificate or key that you will need when you
create an Usergrid notifier. (See <a class="reference external" href="creating-notifiers.html">Creating
notifiers</a> for more information.)</p>
<p>Push notification services are gateways controlled by platform services
(such as Apple and Google). These gateways ensure that push
notifications are delivered securely and originate from trusted apps.</p>
<p>To send push notifications to your app on iOS devices, you’ll register
the the Apple Push Notification service (APNs). For app on Android,
you’ll register with Google Cloud Messaging for Android (GCM).</p>
<div class="admonition note"> <p class="first admonition-title"><p>Note</p>
</p> <p class="last">
For an overview of how to set up push notifications, see `Setting up<p>push notification support &lt;adding-push-support.html&gt;`__.</p>
</p></div><div class="section" id="registering-with-apple-apns">
<h2>Registering with Apple APNs<a class="headerlink" href="#registering-with-apple-apns" title="Permalink to this headline"></a></h2>
<p>Before you can send push notifications to your app on iOS devices,
you&#8217;ll need to get set up so that Apple knows you&#8217;ll be sending
notifications. To do that, you&#8217;ll need to do the following:</p>
<ul class="simple">
<li>Generate an SSL signing certificate you can use to generate a .p12
certificate.</li>
<li>Create an Apple App ID through which you can associate push
notifications support with your app.</li>
<li>Generate a .p12 certificate you can use to create an Usergrid
notifier. The certificate will be sent to APNs with push notification
requests.</li>
</ul>
<p>For more information see &#8220;How the pieces connect&#8221; in <a class="reference external" href="getting-started.html">Setting up push
notification support</a>.</p>
<div class="admonition note"> <p class="first admonition-title"><p>Note</p>
</p> <p class="last">
You'll need a Mac to generate a .p12 certificate and work with APNs.</p></div><div class="section" id="generating-an-ssl-signing-certificate">
<h3>Generating an SSL signing certificate<a class="headerlink" href="#generating-an-ssl-signing-certificate" title="Permalink to this headline"></a></h3>
<p>First, you&#8217;ll create an SSL signing certificate that you can use to
generate a .p12 certificate. To generate an SSL signing certificate, do
the following:</p>
<ol class="arabic simple">
<li>On your development machine, launch the Keychain Access application.</li>
<li>From the Keychain Access menu, select <strong>Certificate Assistant &gt;
Request a Certificate From a Certificate Authority</strong>.</li>
<li>Enter a contact email address and a name you will use to sign your
apps.</li>
<li>Select <strong>Saved to disk</strong>, then click <strong>Continue</strong>.</li>
<li>Select <strong>Desktop</strong> from the Where drop-down, then click <strong>Save</strong> to
download the .certSigningRequest file.</li>
<li>Click <strong>Done</strong> once the download has completed.</li>
</ol>
</div>
<div class="section" id="creating-an-app-id">
<h3>Creating an App ID<a class="headerlink" href="#creating-an-app-id" title="Permalink to this headline"></a></h3>
<p>Next, you must create an App ID for your app. The App ID uniquely
identifies your app and provides a way for you to configure the app for
push notification support. (For more on App IDs, see <a class="reference external" href="https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/MaintainingProfiles/MaintainingProfiles.html">Creating and
Configuring App
IDs</a>.)</p>
<div class="admonition note"> <p class="first admonition-title"><p>Note</p>
</p> <p class="last">
An iOS developer account is required to complete these steps. To<p>register for an iOS developer account, visit the <a class="reference external" href="https://developer.apple.com/">Apple Developer
site</a>.</p>
</p></div><ol class="arabic simple">
<li>Log in to <a class="reference external" href="https://developer.apple.com/ios/manage/overview/index.action">Apple&#8217;s iOS developer
portal</a>.</li>
<li>In the iOS Apps section, click <strong>Identifiers</strong>, then select <strong>App
IDs</strong>.</li>
<li>Click the + icon to create a new App ID, and enter the following:</li>
</ol>
<ul class="simple">
<li><strong>App ID Description - Name</strong>: A unique name that identifies your
app.</li>
<li><strong>App BaaS</strong>: Select Push Notifications.</li>
<li><strong>App ID Suffix</strong>: Select Explicit App ID, and enter your desired App
ID in reverse-domain format. For example, com.apigee.pushapp.</li>
</ul>
<ol class="arabic simple" start="4">
<li>Click <strong>Submit</strong> to create the App ID, then click <strong>Done</strong>. You will
be returned to the App IDs page.</li>
</ol>
</div>
<div class="section" id="generating-a-p12-certificate">
<h3>Generating a .p12 certificate<a class="headerlink" href="#generating-a-p12-certificate" title="Permalink to this headline"></a></h3>
<p>Finally, you will generate the .p12 certificate using the App ID and
signing certificate you created in the previous steps. The .p12
certificate will be sent by Apigee to Apple APNs with all push
notification requests. A unique .p12 certificate is required for each
app. In addition, you should create separate .p12 certificates for
development and production versions of your app.</p>
<ol class="arabic simple">
<li>On the App IDs page, click your new App ID, then click Edit.</li>
<li>In the Push Notifications section, under Development SSL Certificate,
click Create Certificate.</li>
</ol>
<img alt="../_images/pushsslcertificate.png" src="../_images/pushsslcertificate.png" />
<ol class="arabic simple" start="3">
<li>Click <strong>Choose File</strong>, select the .certSigningRequest file you saved
to your Desktop in the previous section, then click <strong>Generate</strong>.</li>
<li>Click <strong>Done</strong>. You will be returned to the App ID settings window.</li>
<li>In the Push Notifications section, click <strong>Download</strong> to save the
certificate (aps_development.cer file) to your Desktop.</li>
<li>Double-click the .cer file to install it in your keychain. The newly
installed certificate will appear in your Keychain Access
application under My Certificates with a name similar to &#8220;Apple
Development iOS Push Services: &#8221;.</li>
<li>Control-click the certificate and select <strong>Export</strong>.</li>
<li>Save the certificate to your Desktop as a &#8216;Personal Information
Exchange (.p12)&#8217; file. (You&#8217;ll need this file when you create a
notifier. For more information, see <a class="reference external" href="creating-notifiers.html">Creating
notifiers</a>.</li>
<li>In the password dialog, leave the password field blank, then click
<strong>OK</strong>.</li>
<li>In the next dialog, enter your system password, then click
<strong>Allow</strong>.</li>
</ol>
</div>
</div>
<div class="section" id="registering-with-google-gcm">
<h2>Registering with Google GCM<a class="headerlink" href="#registering-with-google-gcm" title="Permalink to this headline"></a></h2>
<p>To create a notifier for sending notifications, you&#8217;ll need a Google API
project and register your app as part of that project. The project&#8217;s
identifier (project number) will become the sender ID your client code
will send when registering. Registering your app will give you an API
key you&#8217;ll use to create a notifier. (For more information see &#8220;How the
pieces connect&#8221; in <a class="reference external" href="adding-push-support.html">Adding push notifications
support</a>.)</p>
<p>The following is an abbreviated version of the steps described in the
Google documentation on <a class="reference external" href="http://developer.android.com/google/gcm/gs.html">getting started with Google Cloud
Messaging</a>.</p>
<p>To generate a project number and API key, do the following:</p>
<ol class="arabic simple">
<li>Go to the <a class="reference external" href="https://code.google.com/apis/console/">Google API developer web
site</a> and log in with your
Google ID.</li>
<li>Click <strong>Create Project</strong>, enter a project name and ID, then follow
the steps required to verify.</li>
<li>In the left nav, click <strong>Overview</strong> to view the project number. Note
this number for later use in client code.</li>
</ol>
<img alt="../_images/googleproj0.png" src="../_images/googleproj0.png" />
<ol class="arabic simple" start="4">
<li>Click <strong>APIs</strong> in the left nav area, then click the button to enable
<strong>Google Cloud Messaging for Android</strong>.</li>
</ol>
<img alt="../_images/gcmsetting.png" src="../_images/gcmsetting.png" />
<ol class="arabic simple" start="5">
<li>In the left nav, under <strong>APIs and auth</strong>, click <strong>Credentials</strong>.</li>
<li>Under <strong>Public API access</strong>, click <strong>Create New Key</strong>.</li>
<li>In the <strong>Create a new key</strong> dialog, click <strong>Server key</strong>. Take care
not to choose &#8220;Android key,&#8221; though you might be tempted to.
Remember that your push notification requests will be received by
Google from Apigee&#8217;s server (via the notifier your code sends to
Apigee), rather than directly from the device your app is installed
on.</li>
<li>On the <strong>Create a server key...</strong> dialog, enter the IP address of
the server that will be sending the notification request to Google.</li>
<li>Click <strong>Create</strong>.</li>
<li>On the Credentials page, under <strong>Key for server applications</strong>, copy
the <strong>API key</strong> value for use when creating a notifier to request
push notifications from GCM. (For more information, see <a class="reference external" href="creating-notifiers.html">Creating
notifiers</a>.)</li>
</ol>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="creating-notifiers.html" class="btn btn-neutral float-right" title="Creating notifiers" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="tutorial.html" class="btn btn-neutral" title="Tutorial: Push notifications sample app" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2013-2015, Apache Usergrid.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'2.x',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>