You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/08/26 17:40:30 UTC

[19/36] usergrid git commit: Update generated website content.

http://git-wip-us.apache.org/repos/asf/usergrid/blob/73186077/content/docs/push-notifications/creating-notifiers.html
----------------------------------------------------------------------
diff --git a/content/docs/push-notifications/creating-notifiers.html b/content/docs/push-notifications/creating-notifiers.html
new file mode 100644
index 0000000..308a648
--- /dev/null
+++ b/content/docs/push-notifications/creating-notifiers.html
@@ -0,0 +1,425 @@
+
+
+<!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>Creating notifiers &mdash; Apache Usergrid 1.0 documentation</title>
+  
+
+  
+  
+
+  
+
+  
+  
+    
+
+  
+
+  
+  
+    <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
+  
+
+  
+
+  
+    <link rel="top" title="Apache Usergrid 1.0 documentation" href="../index.html"/>
+        <link rel="next" title="Managing users and devices" href="managing-users-and-devices.html"/>
+        <link rel="prev" title="Registering with a notification service" href="registering.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">
+              1.0
+            </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">Introduction</span></p>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../introduction/overview.html">Documentation Overview</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">Getting Started</span></p>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-account.html">Creating an Usergrid Account</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-a-new-application.html">Creating a new application</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-a-sandbox-app.html">Using a Sandbox Application</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/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"><a class="reference internal" href="registering.html">Registering with a notification service</a></li>
+<li class="toctree-l1 current"><a class="current reference internal" href="">Creating notifiers</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="#requirements">Requirements</a></li>
+<li class="toctree-l2"><a class="reference internal" href="#creating-notifiers-with-the-admin-portal">Creating notifiers with the admin portal</a></li>
+<li class="toctree-l2"><a class="reference internal" href="#creating-notifiers-programmatically">Creating notifiers programmatically</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="#for-apple">For Apple</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#for-google">For Google</a></li>
+</ul>
+</li>
+<li class="toctree-l2"><a class="reference internal" href="#notifier-endpoints">Notifier endpoints</a></li>
+</ul>
+</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 the Stack</span></p>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-deploy-to-tomcat.html">Usegrid 1: Deploying to Tomcat</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-launcher-quick-start.html">Usegrid 1: Launcher Quick-start</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../installation/ug2-deploy-to-tomcat.html">Usergrid 2: Deploy to Tomcat</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>Creating notifiers</li>
+      <li class="wy-breadcrumbs-aside">
+        
+          
+            <a href="../_sources/push-notifications/creating-notifiers.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="creating-notifiers">
+<h1>Creating notifiers<a class="headerlink" href="#creating-notifiers" title="Permalink to this headline">¶</a></h1>
+<p>When you request that a push notification be sent to your app on
+devices, an Usergrid notifier carries the request to the notification
+service (Google GCM or Apple APNs).</p>
+<p>A notifier is represented by an entity in your Usergrid application (see
+the <a class="reference external" href="../rest-endpoints/api-docs.html">API Docs</a> for reference
+information). It carries the credentials that authorize your request.
+Once a notification service has verified that your notifier contains
+valid credentials, it will forward your push notification to your app on
+devices.</p>
+<p>You can create a notifier in two ways: using the admin portal and
+programmatically.</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, including<p>troubleshooting tips, see <a class="reference external" href="adding-push-support.html">Adding push notifications
+support</a>.</p>
+</p></div><div class="section" id="requirements">
+<h2>Requirements<a class="headerlink" href="#requirements" title="Permalink to this headline">¶</a></h2>
+<p>To create a notifier, you must first register your app with the
+appropriate notification service, as described in <a class="reference external" href="registration.html">Registering with a
+notification service</a>.</p>
+</div>
+<div class="section" id="creating-notifiers-with-the-admin-portal">
+<h2>Creating notifiers with the admin portal<a class="headerlink" href="#creating-notifiers-with-the-admin-portal" title="Permalink to this headline">¶</a></h2>
+<p>To create a notifier with the admin portal, do the following:</p>
+<ol class="arabic simple">
+<li>Log in to the admin portal.</li>
+<li>In the left nav, select <strong>Push &gt; Configuration</strong>.</li>
+<li>Click the <strong>Apple</strong> or <strong>Android</strong> tab.</li>
+<li>If you have not already done so, retrieve your .p12 certificate (iOS
+apps) or API key (Android apps) by following the steps in the
+<a class="reference external" href="registration.html">Registering with a notification service</a>.</li>
+<li>In the admin portal&#8217;s Configuration page, enter values for the
+platform on which your mobile app will be installed.</li>
+</ol>
+<p>The fields are different depending on whether you are on the Apple or
+Android tab:</p>
+<p><strong>Fields for Apple</strong></p>
+<table class="usergrid-table">
+<tr><td><p>Name this notifier</p>
+</td> <td><p>Enter a unique name that can be used to identify this notifiers.</p>
+</td></tr>
+<tr><td><p>Certificate</p>
+</td>    <td><p>Click <strong>Choose File</strong> to select the .p12 certificate you generated and
+saved to your desktop earlier in this tutorial.</p>
+</td></tr>
+<tr><td><p>Environment</p>
+</td>    <td><p>Select the environment appropriate to your app. You may select
+development or production. Note that for the environment you select, you
+should have a separate .p12 certificate &#8211; different certificates for
+development and production.</p>
+</td></tr>
+<tr><td><p>Certificate Password</p>
+</td>
+<td><p>Enter a certificate password if one was specified when you created your
+.p12 certificate.</p>
+</td></tr>
+</table><p><strong>Fields for Android</strong></p>
+<table class="usergrid-table">
+<tr><td><p>Name this notifier</p>
+</td> <td><p>Enter a unique name that can be used to identify this notifiers.</p>
+</td></tr>
+<tr><td><p>API Key</p>
+</td>
+<td><p>Enter the API key that was generated when you registered your app with
+GCM. To retrieve your API key, go to the <a class="reference external" href="https://code.google.com/apis/console/">Google API developer web
+site</a>, then select <strong>APIs &amp;
+Auth &gt; Credentials</strong>.</p>
+</td></tr>
+</table><ol class="arabic simple" start="6">
+<li>Click <strong>Create Notifier</strong>. The Usergrid will create a notifier entity
+in the /notifiers collection. The notifier will also appear in the
+list of notifiers in the notifications console.</li>
+</ol>
+</div>
+<div class="section" id="creating-notifiers-programmatically">
+<h2>Creating notifiers programmatically<a class="headerlink" href="#creating-notifiers-programmatically" title="Permalink to this headline">¶</a></h2>
+<p>You can create an App BaaS notifier programmatically by sending requests
+to the Usergrid API.</p>
+<div class="section" id="for-apple">
+<h3>For Apple<a class="headerlink" href="#for-apple" title="Permalink to this headline">¶</a></h3>
+<div class="highlight-python"><div class="highlight"><pre>curl -X POST -i -H &quot;Accept: application/json&quot; -H &quot;Accept-Encoding: gzip, deflate&quot; -H &quot;Authorization: Bearer YWMtFeeWEMyNEeKtbNX3o4PU0QAAAT8vzK3xz3utVZat0CosiYm75C2qpiGT79c&quot; -F &quot;name=applenotifier&quot; -F &quot;provider=apple&quot; -F &quot;environment=development&quot; -F &quot;p12Certificate=@/Users/me/dev/pushtest_dev.p12&quot; &#39;https://api.usergrid.com/my-org/my-app/notifiers&#39;
+</pre></div>
+</div>
+</div>
+<div class="section" id="for-google">
+<h3>For Google<a class="headerlink" href="#for-google" title="Permalink to this headline">¶</a></h3>
+<div class="highlight-python"><div class="highlight"><pre>curl -X POST &quot;https://api.usergrid.com/my-org/my-app/notifiers&quot; -d &#39;{&quot;name&quot;:&quot;androiddev&quot;, &quot;provider&quot;:&quot;google&quot;, &quot;apiKey&quot;:&quot;AIzaSyCkXOtBQ7A9GoJsSLqZlod_YjEfxxxxxxx&quot;}&#39;
+</pre></div>
+</div>
+</div>
+</div>
+<div class="section" id="notifier-endpoints">
+<h2>Notifier endpoints<a class="headerlink" href="#notifier-endpoints" title="Permalink to this headline">¶</a></h2>
+<p>The following are the available notifier endpoints. For details on
+notifier properties, see the <a class="reference external" href="../rest-endpoints/api-docs.html">API
+Docs</a>.</p>
+<p>Base URL: <code class="docutils literal"><span class="pre">https://api.usergrid.com/my-org/my-app/</span></code></p>
+<p>Working with one or more notifiers:</p>
+<div class="highlight-python"><div class="highlight"><pre>/notifiers
+</pre></div>
+</div>
+<p>Working with notifiers associated with specific devices:</p>
+<div class="highlight-python"><div class="highlight"><pre>/devices/{device-id}/notifier
+</pre></div>
+</div>
+</div>
+</div>
+
+
+           </div>
+          </div>
+          <footer>
+  
+    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
+      
+        <a href="managing-users-and-devices.html" class="btn btn-neutral float-right" title="Managing users and devices" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
+      
+      
+        <a href="registering.html" class="btn btn-neutral" title="Registering with a notification service" 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:'1.0',
+            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>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/usergrid/blob/73186077/content/docs/push-notifications/getting-started.html
----------------------------------------------------------------------
diff --git a/content/docs/push-notifications/getting-started.html b/content/docs/push-notifications/getting-started.html
new file mode 100644
index 0000000..bad6ba9
--- /dev/null
+++ b/content/docs/push-notifications/getting-started.html
@@ -0,0 +1,497 @@
+
+
+<!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>Getting started with push notifications &mdash; Apache Usergrid 1.0 documentation</title>
+  
+
+  
+  
+
+  
+
+  
+  
+    
+
+  
+
+  
+  
+    <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
+  
+
+  
+
+  
+    <link rel="top" title="Apache Usergrid 1.0 documentation" href="../index.html"/>
+        <link rel="next" title="Tutorial: Push notifications sample app" href="tutorial.html"/>
+        <link rel="prev" title="Adding push notifications support" href="adding-push-support.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">
+              1.0
+            </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">Introduction</span></p>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../introduction/overview.html">Documentation Overview</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">Getting Started</span></p>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-account.html">Creating an Usergrid Account</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-a-new-application.html">Creating a new application</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-a-sandbox-app.html">Using a Sandbox Application</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/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 current"><a class="current reference internal" href="">Getting started with push notifications</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="#what-are-push-notifications">What are push notifications?</a></li>
+<li class="toctree-l2"><a class="reference internal" href="#prerequisites">Prerequisites</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="#ios-prerequisites">iOS Prerequisites</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#android-prerequisites">Android Prerequisites</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#phonegap-prerequisites">PhoneGap Prerequisites</a></li>
+</ul>
+</li>
+<li class="toctree-l2"><a class="reference internal" href="#setup-overview">Setup overview</a></li>
+<li class="toctree-l2"><a class="reference internal" href="#how-it-works">How it works</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="#apple-apns">Apple APNs</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#google-gcm">Google GCM</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li class="toctree-l1"><a class="reference internal" href="tutorial.html">Tutorial: Push notifications sample app</a></li>
+<li class="toctree-l1"><a class="reference internal" href="registering.html">Registering with a notification service</a></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 the Stack</span></p>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-deploy-to-tomcat.html">Usegrid 1: Deploying to Tomcat</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-launcher-quick-start.html">Usegrid 1: Launcher Quick-start</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../installation/ug2-deploy-to-tomcat.html">Usergrid 2: Deploy to Tomcat</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>Getting started with push notifications</li>
+      <li class="wy-breadcrumbs-aside">
+        
+          
+            <a href="../_sources/push-notifications/getting-started.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="getting-started-with-push-notifications">
+<h1>Getting started with push notifications<a class="headerlink" href="#getting-started-with-push-notifications" title="Permalink to this headline">¶</a></h1>
+<div class="section" id="what-are-push-notifications">
+<h2>What are push notifications?<a class="headerlink" href="#what-are-push-notifications" title="Permalink to this headline">¶</a></h2>
+<p>Usergrid provides a RESTful framework for sending push notifications to
+your apps, giving you full control over which app users you target, as
+well as when you send notifications. You can send messages to devices,
+users, or groups that have specific characteristics and locations. (To
+receive push notifications, users must be using devices that can connect
+to the Usergrid). Here are just a couple reasons for enabling push
+notification support in your app with Usergrid:</p>
+<ul class="simple">
+<li><strong>Reach your app&#8217;s users</strong> with messages they care about. This could
+be a flash sale happening near them right now (use
+<a class="reference external" href="../geolocation/geolocation.html">geolocation</a>!) or a lunch
+special at a favorite restaurant. You could even let a user know it&#8217;s
+her turn in a game she&#8217;s playing with a friend.</li>
+<li><strong>Keep your app footprint low</strong> while communicating in a high-value
+way with your app&#8217;s users. Compare pushing data with CPU- and
+memory-heavy pull processes. In those, an app actively listens on an
+endpoint, regularly pulling data (such as news feeds, new emails, or
+stock market updates) to the device.</li>
+</ul>
+<center>
+<iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/W560tZ5fSIc" width="560"></iframe>
+</center>
+
+<p></p></div>
+<div class="section" id="prerequisites">
+<h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Permalink to this headline">¶</a></h2>
+<p>You will need to test with a mobile device running the platform you&#8217;re
+developer for. In the case of Android, you might be able to use an
+emulator. It is not possible to test push notifications from a web
+browser.</p>
+<div class="section" id="ios-prerequisites">
+<h3>iOS Prerequisites<a class="headerlink" href="#ios-prerequisites" title="Permalink to this headline">¶</a></h3>
+<p>To develop push notifications for an iOS app, you&#8217;ll need:</p>
+<ul class="simple">
+<li>A Mac to generate the necessary SSL certificate.</li>
+<li>An iOS developer account. You&#8217;ll need this to register for an App ID
+and get a provisioning profile. To get an account, visit the <a class="reference external" href="https://developer.apple.com/ios/download/">iOS Dev
+Center</a>.</li>
+<li>An actual iOS device to test push notifications. It&#8217;s not yet
+possible to develop push notifications with an emulator.</li>
+<li>An iOS provisioning profile For iOS app testing, you need a
+provisioning profile that&#8217;s associated with an Apple ID. You set up
+the provisioning profile in the Apple developer portal, download the
+profile, and import it into Xcode.</li>
+</ul>
+<p>To set up a provisioning profile, you need to create an &#8220;iOS App
+Development&#8221; certificate in the Apple developer portal. For example, in
+the Apple APNs setup earlier in this tutorial, you created a certificate
+in the Apple developer portal to be used for push notifications.
+However, you won&#8217;t be able to create a provisioning portal with just
+that certificate. You also need to create an &#8220;iOS App Development&#8221;
+certificate (the configuration settings don&#8217;t matter), as shown in the
+following image.</p>
+<img alt="../_images/ios-cert.png" src="../_images/ios-cert.png" />
+<p>After you create an iOS App Development certificate, you can create a
+provisioning profile that includes your App ID/certificate for push
+notifications.</p>
+</div>
+<div class="section" id="android-prerequisites">
+<h3>Android Prerequisites<a class="headerlink" href="#android-prerequisites" title="Permalink to this headline">¶</a></h3>
+<p>It&#8217;s generally a best practice to develop Android apps by testing and
+debugging with an Android device. It&#8217;s also possible to use an emulator.</p>
+<p>Before testing and debugging with an Android device, you&#8217;ll need to set
+up your device for development. Be sure to see the Android documentation
+on <a class="reference external" href="http://developer.android.com/tools/device.html">using hardware
+devices</a>.</p>
+<p>To test with an emulator, you will need to follow these steps:</p>
+<ol class="arabic simple">
+<li>Ensure that you have Google API 8 (or above) and Android 2.2 (or
+above).</li>
+<li>Using the Android SDK Manager, install Google Cloud Messaging for
+Android Library.</li>
+<li>Using the Android Virtual Device Manager, create an emulator whose
+target is Google APIs.</li>
+<li>Ensure that the emulator you&#8217;re using includes a Google account.</li>
+</ol>
+<p>Next:</p>
+<ul class="simple">
+<li>Launch the emulator.</li>
+<li>In the emulator, click the Menu button, then go to Settings &gt;
+Accounts &amp; Sync.</li>
+<li>Add a Google account.</li>
+<li>Once you&#8217;ve finished these steps, you should have an emulator that
+can receive push notification messages.</li>
+</ul>
+</div>
+<div class="section" id="phonegap-prerequisites">
+<h3>PhoneGap Prerequisites<a class="headerlink" href="#phonegap-prerequisites" title="Permalink to this headline">¶</a></h3>
+<p>You&#8217;ll need to test with a device or emulator. It is not possible to
+test push notifications with a browser alone.</p>
+</div>
+</div>
+<div class="section" id="setup-overview">
+<h2>Setup overview<a class="headerlink" href="#setup-overview" title="Permalink to this headline">¶</a></h2>
+<p>The following steps get you set up so that your app can receive push
+notifications. Keep in mind that these steps build on one another. In
+other words, you&#8217;ll need values generated in step 1 in order to complete
+step 2, and so on.</p>
+<p>For a walkthrough of these steps using a push sample app, see Tutorial:
+Push notifications sample app.</p>
+<ol class="arabic simple">
+<li><strong>Register</strong> your app with push notification services. Your
+notification messages will be forwarded to devices by Apple and/or
+Google. So you&#8217;ll need to register with Apple APNs and/or Google&#8217;s
+GCM. For more information, see Registering with a notification
+service.</li>
+<li><strong>Create a notifier</strong> to send notification messages from the Usergrid
+to notification services. The Usergrid will use your notifier to send
+your messages to a notification service. For details, see Creating
+notifiers. To create a notifier, you&#8217;ll need information generated by
+registering with a push notification service. You&#8217;ll need a separate
+notifier for each app/platform combination.</li>
+<li><strong>Register devices at run time</strong>. At run time, your code will
+register to receive notifications. To do this, your code uses
+information from the notification service and your notifier. For
+more, see Managing users and devices.</li>
+<li><strong>Send and manage push notifications</strong>. You use Usergrid API
+notification endpoints to target devices, users, or groups with your
+messages. To learn more, see Creating and managing notifications.</li>
+</ol>
+</div>
+<div class="section" id="how-it-works">
+<h2>How it works<a class="headerlink" href="#how-it-works" title="Permalink to this headline">¶</a></h2>
+<p>Click a tab below to view more information about how the pieces connect
+once you&#8217;ve got it set up.</p>
+<div class="section" id="apple-apns">
+<h3>Apple APNs<a class="headerlink" href="#apple-apns" title="Permalink to this headline">¶</a></h3>
+<p>The diagram below illustrates what things should look like once you&#8217;ve
+gotten set up to send notifications that are received by your app.</p>
+<p><strong>A.</strong> At configuration time, you <a class="reference external" href="registering.html">create an App
+ID</a>, then <a class="reference external" href="creating-notifiers.html">create a
+notifier</a> with a .p12 certificate you
+generate on your Mac. The .p12 certificate correlates the notifier
+(which you will use to send notification messages) with the App ID (so
+that APNs will forward your notifications to devices).</p>
+<p><strong>B.</strong> A run time, your app&#8217;s code <a class="reference external" href="managing-users-and-devices.html">registers with Apple for
+notifications</a> by invoking the
+<code class="docutils literal"><span class="pre">registerForRemoteNotificationTypes</span></code> method to receive a token it can
+send to Usergrid.</p>
+<p><strong>C.</strong> At run time, your app&#8217;s code <a class="reference external" href="managing-users-and-devices.html">registers with the Usergrid for
+notifications</a> by sending the name
+of the notifier you created. This ensure&#8217;s that there&#8217;s a device entity
+in your Usergrid application. That way, you can address the device with
+notification messages.</p>
+<img alt="../_images/pushmiddleios0.png" src="../_images/pushmiddleios0.png" />
+<p><strong>Note</strong>: For information on troubleshooting push notifications on iOS
+devices, see <a class="reference external" href="troubleshooting.html">Troubleshooting Push
+Notifications</a></p>
+</div>
+<div class="section" id="google-gcm">
+<h3>Google GCM<a class="headerlink" href="#google-gcm" title="Permalink to this headline">¶</a></h3>
+<p>The diagram below illustrates what things should look like once you&#8217;ve
+gotten set up to send notifications that are received by your app.</p>
+<p><strong>A.</strong> At configuration time, you <a class="reference external" href="registering.html">create a Google API
+project</a>), then <a class="reference external" href="creating-notifiers.html">create an Usergrid
+notifier</a> with an API key from the project.
+The API key correlates the notifier (which you will use to send
+notification messages from the Usergrid) with the API project (which
+will forward your notifications to devices).</p>
+<p><strong>B.</strong> At run time, your app&#8217;s code <a class="reference external" href="managing-users-and-devices.html">registers with the
+Usergrid</a>) for notifications by
+sending the name of the notifier you created. This ensure&#8217;s that there&#8217;s
+a device entity in your Usergrid application. That way, you can address
+the device with notification messages.</p>
+<p><strong>C.</strong> A run time, your app&#8217;s code <a class="reference external" href="managing-users-and-devices.html">registers with Google for
+notifications</a>) by sending the
+number of your API project as a &#8220;sender ID&#8221;. The project is the actual
+notification &#8220;sender&#8221; that will forward notifications to your app. In
+other words, the app is telling Google that it wants to receive
+notifications from that sender.</p>
+<img alt="../_images/pushmiddleandroid0.png" src="../_images/pushmiddleandroid0.png" />
+</div>
+</div>
+</div>
+
+
+           </div>
+          </div>
+          <footer>
+  
+    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
+      
+        <a href="tutorial.html" class="btn btn-neutral float-right" title="Tutorial: Push notifications sample app" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
+      
+      
+        <a href="adding-push-support.html" class="btn btn-neutral" title="Adding push notifications support" 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:'1.0',
+            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>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/usergrid/blob/73186077/content/docs/push-notifications/managing-users-and-devices.html
----------------------------------------------------------------------
diff --git a/content/docs/push-notifications/managing-users-and-devices.html b/content/docs/push-notifications/managing-users-and-devices.html
new file mode 100644
index 0000000..d7afe4f
--- /dev/null
+++ b/content/docs/push-notifications/managing-users-and-devices.html
@@ -0,0 +1,688 @@
+
+
+<!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>Managing users and devices &mdash; Apache Usergrid 1.0 documentation</title>
+  
+
+  
+  
+
+  
+
+  
+  
+    
+
+  
+
+  
+  
+    <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
+  
+
+  
+
+  
+    <link rel="top" title="Apache Usergrid 1.0 documentation" href="../index.html"/>
+        <link rel="next" title="Creating and managing notifications" href="creating-and-managing-notifications.html"/>
+        <link rel="prev" title="Creating notifiers" href="creating-notifiers.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">
+              1.0
+            </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">Introduction</span></p>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../introduction/overview.html">Documentation Overview</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">Getting Started</span></p>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-account.html">Creating an Usergrid Account</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/creating-a-new-application.html">Creating a new application</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/using-a-sandbox-app.html">Using a Sandbox Application</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../getting-started/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"><a class="reference internal" href="registering.html">Registering with a notification service</a></li>
+<li class="toctree-l1"><a class="reference internal" href="creating-notifiers.html">Creating notifiers</a></li>
+<li class="toctree-l1 current"><a class="current reference internal" href="">Managing users and devices</a><ul>
+<li class="toctree-l2"><a class="reference internal" href="#registering-devices">Registering devices</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="#registering-for-ios">Registering for iOS</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#registering-for-android">Registering for Android</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#registering-for-html5-phonegap">Registering for HTML5/PhoneGap</a></li>
+</ul>
+</li>
+<li class="toctree-l2"><a class="reference internal" href="#connecting-devices-to-users">Connecting devices to users</a><ul>
+<li class="toctree-l3"><a class="reference internal" href="#connecting-with-curl">Connecting with curl</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#connecting-with-ios">Connecting with iOS</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#connecting-with-android">Connecting with Android</a></li>
+<li class="toctree-l3"><a class="reference internal" href="#connecting-with-html5-javascript">Connecting with HTML5/JavaScript</a></li>
+</ul>
+</li>
+</ul>
+</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 the Stack</span></p>
+<ul>
+<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-deploy-to-tomcat.html">Usegrid 1: Deploying to Tomcat</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../installation/ug1-launcher-quick-start.html">Usegrid 1: Launcher Quick-start</a></li>
+<li class="toctree-l1"><a class="reference internal" href="../installation/ug2-deploy-to-tomcat.html">Usergrid 2: Deploy to Tomcat</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>Managing users and devices</li>
+      <li class="wy-breadcrumbs-aside">
+        
+          
+            <a href="../_sources/push-notifications/managing-users-and-devices.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="managing-users-and-devices">
+<h1>Managing users and devices<a class="headerlink" href="#managing-users-and-devices" title="Permalink to this headline">¶</a></h1>
+<p>Before your app can receive notifications on a user&#8217;s device, the app&#8217;s
+code will need to register the device with both the Usergrid and the
+appropriate push notification service (Apple APNs or Google GCM).</p>
+<p>By registering with the Usergrid, your app adds the device on which it
+is installed to your data store. The device is represented as a Device
+entity. This makes it possible for you to target that device when
+sending notifications. (For more on the Device entity, see the <a class="reference external" href="../rest-endpoints/api-docs.html">API
+Docs</a>.) Any devices, users, and
+groups that have been registered in this way may be targeted with push
+notifications.</p>
+<p>By registering with the notification service, you make the device known
+to the service. This way, the service can forward your notifications to
+the device.</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, including<p>troubleshooting tips, see <a class="reference external" href="adding-push-support.html">Adding push notifications
+support</a>.</p>
+</p></div><div class="section" id="registering-devices">
+<h2>Registering devices<a class="headerlink" href="#registering-devices" title="Permalink to this headline">¶</a></h2>
+<p>The following samples illustrate how to register a device with a
+notification service and with the Usergrid. At a high level, your code
+will send a registration request to the notification service, then use
+information in the service&#8217;s response to send a separate request to the
+Usergrid. The two requests correlate the notification service, Usergrid,
+and your mobile app.</p>
+<p>You can also create device entities separately by using the /devices
+endpoint. For more information on using the <code class="docutils literal"><span class="pre">/devices</span></code> endpoint in the
+Usergrid, see the <a class="reference external" href="../rest-endpoints/api-docs.html">API Docs</a>.</p>
+<p>Registering a device with a notification service is a standard coding
+activity for implementing push notifications. This is not specific to
+the Usergrid.</p>
+<div class="section" id="registering-for-ios">
+<h3>Registering for iOS<a class="headerlink" href="#registering-for-ios" title="Permalink to this headline">¶</a></h3>
+<p>The following code illustrates how you can use the iOS SDK to register a
+device with both the Usergrid server and with the APNs, the Apple push
+notification service. This example assumes that your code has already
+property initialized the SDK. For more information, see <a class="reference external" href="../sdks/tbd.html">Installing the
+Apigee SDK for iOS</a>.</p>
+<div class="highlight-python"><div class="highlight"><pre>// Register with Apple to receive notifications.
+
+// Invoked when the application moves from an inactive to active state. Use this
+// method to register with Apple for notifications.
+- (void)applicationDidBecomeActive:(UIApplication *)application
+{
+    // Find out what notification types the user has enabled.
+    UIRemoteNotificationType enabledTypes =
+        [application enabledRemoteNotificationTypes];
+
+    // If the user has enabled alert or sound notifications, then
+    // register for those notification types from Apple.
+    if (enabledTypes &amp; (UIRemoteNotificationTypeAlert|UIRemoteNotificationTypeSound)) {
+
+        // Register for push notifications with Apple
+        NSLog(@&quot;registering for remote notifications&quot;);
+        [application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert |
+         UIRemoteNotificationTypeSound];
+    }
+}
+
+// Invoked as a callback from calling registerForRemoteNotificationTypes.
+// newDeviceToken is a token received from registering with Apple APNs.
+// Use this method to register with Apigee.
+- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)newDeviceToken
+{
+    // Register device token with the Usergrid (will create the Device entity if it doesn&#39;t exist)
+    // Sends the name of the notifier you created with Apigee, along with the token your code
+    // received from Apple.
+    ApigeeClientResponse *response = [dataClient setDevicePushToken: newDeviceToken
+                                                        forNotifier: notifier];
+
+    if ( ! [response completedSuccessfully]) {
+        [self alert: response.rawResponse title: @&quot;Error&quot;];
+    }
+}
+
+// Invoked as a callback from calling registerForRemoteNotificationTypes if registration
+// failed.
+- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
+{
+    [self alert: error.localizedDescription title: @&quot;Error&quot;];
+}
+</pre></div>
+</div>
+<p>Initialize the Apigee client and check for notifications that might have
+been sent while the app was off.</p>
+<div class="highlight-python"><div class="highlight"><pre>// Invoked as a callback after the application launches.
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+    // Connect and login
+    ApigeeClient *apigeeClient =
+        [[ApigeeClient alloc] initWithOrganizationId:orgName
+                                       applicationId:appName
+                                             baseURL:baseURL];
+    dataClient = [apigeeClient dataClient];
+    [dataClient setLogging:true]; //comment out to remove debug output from the console window
+
+    // Find out if there&#39;s a notification waiting to be handled after the
+    // app launches.
+    if (launchOptions != nil) {
+        NSDictionary* userInfo =
+            [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
+
+        // If there&#39;s notification data waiting, send it to be processed.
+        if (userInfo) {
+            [self handlePushNotification:userInfo
+                          forApplication:application];
+        }
+    }
+
+    // It&#39;s not necessary to explicitly login if the Guest role allows access.
+    // But this is how you can do it.
+//    [apigeeClient logInUser: userName password: password];
+
+    NSLog(@&quot;done launching&quot;);
+    return YES;
+}
+</pre></div>
+</div>
+</div>
+<div class="section" id="registering-for-android">
+<h3>Registering for Android<a class="headerlink" href="#registering-for-android" title="Permalink to this headline">¶</a></h3>
+<p>The following code illustrates how to register a client device with GCM,
+register the device with Apigee, and associate the device with the user.
+Methods used in this code are defined in the Apigee Android SDK. For
+more information on downloading and installing the SDK, see Installing
+the Apigee SDK for Android.</p>
+<div class="highlight-python"><div class="highlight"><pre>import android.content.Context;
+import com.google.android.gcm.GCMRegistrar;
+import com.apigee.sdk.ApigeeClient;
+import com.apigee.sdk.data.client.entities.Device;
+
+/**
+ * Registers this device with GCM, Google&#39;s messaging
+ * service.
+ *
+ * @param context An Android context with information specific to this
+ * application&#39;s context on the device.
+ */
+static void registerPush(Context context) {
+
+    //Get an instance of the Apigee DataClient class from the ApigeeClient object
+    dataClient = getClient().getDataClient();
+
+    // Get the registration ID (GCM API key) for this application.
+    final String regId = GCMRegistrar.getRegistrationId(context);
+
+    // If this device isn&#39;t already registered with GCM, register it
+    // using the the application context and an ID for the Google account
+    // authorized to send messages to this application. This is the
+    // Google Client ID from Google API Console.
+    if (&quot;&quot;.equals(regId)) {
+      GCMRegistrar.register(context, gcmSenderId);
+    } else {
+        if (GCMRegistrar.isRegisteredOnServer(context)) {
+            Log.i(TAG, &quot;Already registered with GCM&quot;);
+        } else {
+
+        // Use an instance of the Client class (SDK for Android)
+        // to register this device with the Usergrid. Pass as arguments
+        // the device unique identifier, the unique name of the notifier you
+        // created in the Usergrid, the GCM API key, and a callback that will
+        // receive an instance of a Device class representing the registered
+        // device on the system.
+        dataClient.registerDeviceForPushAsync(dataClient.getUniqueDeviceID(), notifierName, regId, null,
+            new DeviceRegistrationCallback() {
+                @Override
+                public void onResponse(Device device) {
+                    AppServices.device = device;
+
+                    // Associate the logged in user with this device.
+                    if (dataClient.getLoggedInUser() != null) {
+                        dataClient.connectEntitiesAsync(&quot;users&quot;,
+                            dataClient.getLoggedInUser().getUuid().toString(),
+                            &quot;devices&quot;, device.getUuid().toString(),
+                            new ApiResponseCallback() {
+                                @Override
+                                public void onResponse(ApiResponse apiResponse) {
+                                  Log.i(TAG, &quot;connect response: &quot; + apiResponse);
+                                }
+
+                                @Override
+                                public void onException(Exception e) {
+                                  displayMessage(context, &quot;Connect Exception: &quot; + e);
+                                  Log.i(TAG, &quot;connect exception: &quot; + e);
+                                }
+                        });
+                    }
+                }
+
+            });
+        }
+    }
+}
+
+/**
+ * Create an instance of the SDK ApigeeClient class, setting
+ * values from your Apigee registration.
+ */
+static synchronized ApigeeClient getClient() {
+    if (client == null) {
+        client = new ApigeeClient();
+        client.setApiUrl(&quot;https://api.usergrid.com&quot;);
+        client.setOrganizationId(&quot;your-org&quot;);
+        client.setApplicationId(&quot;your-app&quot;);
+    }
+    return client;
+}
+</pre></div>
+</div>
+</div>
+<div class="section" id="registering-for-html5-phonegap">
+<h3>Registering for HTML5/PhoneGap<a class="headerlink" href="#registering-for-html5-phonegap" title="Permalink to this headline">¶</a></h3>
+<p>The following code illustrates how you can use the JavaScript functions
+included with the PhoneGap plugin to register a device with both the
+Apigee server and with the APNs, the Apple push notification service.</p>
+<div class="highlight-python"><div class="highlight"><pre>// Declare a variable for calling push notification APIs.
+var pushNotification = window.plugins.pushNotification;
+// Collect configuration options to specify that this device accepts
+// an alert message, an application badge, and a sound.
+var appleOptions = {
+    alert:true, badge:true, sound:true
+};
+// Register the device with the Usergrid, passing options for configuration
+// along with a callback from which you can retrieve the device token
+// sent by Apigee.
+pushNotification.registerDevice(appleOptions, function(status) {
+    console.log(status);
+    // If a token was received, bundle options to pass when registering the device
+    // with the push notification service. The provider value must be &quot;apigee&quot; to
+    // support push notification through Apigee. orgName and appName should be
+    // values corresponding to those used in your Apigee account.
+    // notifier is the unique name you associated with the Apigee notifier you created.
+    // token is the device token this code received from Apigee after registering the
+    // device.
+    if(status.deviceToken) {
+        var options = {
+            &quot;provider&quot;:&quot;apigee&quot;,
+            &quot;orgName&quot;:&quot;YOUR APIGEE.COM USERNAME&quot;,
+            &quot;appName&quot;:&quot;sandbox&quot;,
+            &quot;notifier&quot;:&quot;YOUR NOTIFIER&quot;,
+            &quot;token&quot;:status.deviceToken
+        };
+
+        // Use the device token and other options to register this device with the
+        // push notification provider.
+        pushNotification.registerWithPushProvider(options, function(status){
+            console.log(status);
+        });
+    }
+});
+</pre></div>
+</div>
+<p>The functions used in this code are defined in the PhoneGap plugin.
+JavaScript functions invoke underlying Objective-C or Java code
+(depending on platform). You&#8217;ll find that code in these files, included
+in the Apigee PhoneGap push notification plug-in.</p>
+<p>Information about installing the plugin is available in its Readme file.
+For more complete examples, see <a class="reference external" href="tutorial.html">Tutorial: Push notifications sample
+app</a>.</p>
+</div>
+</div>
+<div class="section" id="connecting-devices-to-users">
+<h2>Connecting devices to users<a class="headerlink" href="#connecting-devices-to-users" title="Permalink to this headline">¶</a></h2>
+<p>You can associate user entities with device entities in the Usergrid.
+Doing so allows you to target your push notifications at users with
+specific characteristics. The following describes how to connect a user
+to a specific device in the Usergrid.</p>
+<p>For more information on creating a device in your Usergrid data store,
+see &#8220;Registering Devices&#8221; above.</p>
+<p>For more information on creating a user in your Usergrid data store, see
+<a class="reference external" href="../rest-endpoints/api-docs.html#user">User</a>.</p>
+<p>The following code examples all use the same basic endpoint pattern for
+connecting devices with users:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">POST</span> <span class="o">/</span><span class="n">users</span><span class="o">/</span><span class="p">{</span><span class="n">userUUID</span> <span class="ow">or</span> <span class="n">name</span><span class="p">}</span><span class="o">/</span><span class="n">devices</span><span class="o">/</span><span class="p">{</span><span class="n">deviceUUID</span><span class="p">}</span>
+</pre></div>
+</div>
+<div class="section" id="connecting-with-curl">
+<h3>Connecting with curl<a class="headerlink" href="#connecting-with-curl" title="Permalink to this headline">¶</a></h3>
+<p>The following call connects user &#8220;joex&#8221; with device
+7a0a1cba-9a18-3bee-8ae3-4f511f12a386 (the device UUID). After this
+connection, you can send a push notification to joex rather than the
+device. Further, if joex has specific properties set&#8211;such as
+{&#8220;favoritecolor&#8221;: &#8220;blue&#8221;}&#8211;you can send a push notification to all users
+whose favorite color is blue (assuming they&#8217;re connected to devices in
+the Usergrid).</p>
+<div class="highlight-python"><div class="highlight"><pre>curl -X POST &quot;https://api.usergrid.com/my-org/sandbox/users/joex/devices/7a0a1cba-9a18-3bee-8ae3-4f511f12a386&quot;
+</pre></div>
+</div>
+</div>
+<div class="section" id="connecting-with-ios">
+<h3>Connecting with iOS<a class="headerlink" href="#connecting-with-ios" title="Permalink to this headline">¶</a></h3>
+<p>The following sample code, taken from AppDelegate.m in the native iOS
+push sample, uses the connectEntities method from the iOS SDK to connect
+a device to a user.</p>
+<div class="highlight-python"><div class="highlight"><pre>ApigeeClientResponse *response = [dataClient setDevicePushToken: newDeviceToken forNotifier: notifier];
+
+// You could use this if you log in as an Usergrid user to associate the Device to your User
+if (response.transactionState == kUGClientResponseSuccess) {
+    response = [self connectEntities: @&quot;users&quot; connectorID: @&quot;me&quot; type: @&quot;devices&quot; connecteeID: deviceId];
+}
+</pre></div>
+</div>
+</div>
+<div class="section" id="connecting-with-android">
+<h3>Connecting with Android<a class="headerlink" href="#connecting-with-android" title="Permalink to this headline">¶</a></h3>
+<p>The following sample code, taken from
+<a class="reference external" href="https://github.com/apigee/appservices-android-push-example/blob/master/src/com/ganyo/pushtest/AppServices.java">AppServices.java</a>
+in the native Android push sample, uses the connectEntitiesAsync method
+from the Android SDK to connect a device to an authenticated user.</p>
+<div class="highlight-python"><div class="highlight"><pre>// connect Device to current User - if there is one
+if (dataClient.getLoggedInUser() != null) {
+  dataClient.connectEntitiesAsync(&quot;users&quot;, dataClient.getLoggedInUser().getUuid().toString(),
+                                   &quot;devices&quot;, device.getUuid().toString(),
+                                   new ApiResponseCallback() {...
+</pre></div>
+</div>
+</div>
+<div class="section" id="connecting-with-html5-javascript">
+<h3>Connecting with HTML5/JavaScript<a class="headerlink" href="#connecting-with-html5-javascript" title="Permalink to this headline">¶</a></h3>
+<p>The following code illlustrates how to associate the currently logged in
+user with their device.</p>
+<div class="highlight-python"><div class="highlight"><pre>// You&#39;ll need a client from the JavaScript SDK.
+var client = new Apigee.Client({
+    // Initialize client.
+});
+
+// Get information about the current user so you can use
+// it to connect them with their device.
+client.getLoggedInUser(function(err, data, user) {
+    if(err) {
+        // Could not get the logged in user.
+    } else {
+        if (client.isLoggedIn()) {
+            // Using a PushNotification function to get the device ID as
+            // it is known to the Apigee system.
+            pushNotification.getApigeeDeviceId(function(results) {
+                if (results.deviceId) {
+                    // Use the JavaScript SDK connect function to register
+                    // a connection between the current user and their device.
+                    user.connect(&#39;devices&#39;, results.deviceId, function (err, data) {
+                        if (err) {
+                            // Could not make the connection.
+                        } else {
+                            // Call succeeded, so pull the connections back down.
+                            user.getConnections(&#39;devices&#39;, function (err, data) {
+                            if (err) {
+                                // Couldn&#39;t get the connections.
+                            } else {
+                                // Connection exists.
+                            });
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+</pre></div>
+</div>
+<p>You can also connect users with groups so that you can send push
+notifications to groups of users (and their associated devices), see
+<a class="reference external" href="../user-management/group.html">Working with group data</a>.</p>
+</div>
+</div>
+</div>
+
+
+           </div>
+          </div>
+          <footer>
+  
+    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
+      
+        <a href="creating-and-managing-notifications.html" class="btn btn-neutral float-right" title="Creating and managing notifications" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
+      
+      
+        <a href="creating-notifiers.html" class="btn btn-neutral" title="Creating notifiers" 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:'1.0',
+            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>
\ No newline at end of file