| <h2>1. Import the SDK into your HTML</h2> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <p> |
| To enable support for Apigee-related functions in your HTML, you'll |
| need to include |
| <code>apigee.js</code> |
| in your app. To do this, add the following to the |
| <code>head</code> |
| block of your HTML: |
| </p> |
| <pre> |
| <script type="text/javascript" src="path/to/js/sdk/apigee.js"></script> |
| </pre> |
| <h2>2. Instantiate Apigee.Client</h2> |
| <p>Apigee.Client initializes the App Services SDK, and gives you |
| access to all of the App Services SDK methods.</p> |
| <p>You will need to pass a JSON object with the UUID or name for |
| your App Services organization and application when you instantiate |
| it.</p> |
| <pre> |
| //Apigee account credentials, available in the App Services admin portal |
| var client_creds = { |
| orgName:'{{currentOrg}}', |
| appName:'{{currentApp}}' |
| } |
| |
| //Initializes the SDK. Also instantiates Apigee.MonitoringClient |
| var dataClient = new Apigee.Client(client_creds); |
| </pre> |
| |
| <h2>3. Verify SDK installation</h2> |
| |
| <p> |
| Once initialized, App Services will also automatically instantiate |
| <code>Apigee.MonitoringClient</code> |
| and begin logging usage, crash and error metrics for your app. |
| </p> |
| |
| <p> |
| To verify that the SDK has been properly initialized, run your app, |
| then go to <strong>'Monitoring' > 'App Usage'</strong> in the <a |
| href="https://www.apigee.com/usergrid">App Services admin portal</a> |
| to verify that data is being sent. |
| </p> |
| <p> |
| <img src="img/verify.png" alt="screenshot of data in admin portal" /> |
| </p> |
| <div class="warning">It may take up to two minutes for data to |
| appear in the admin portal after you run your app.</div> |
| |
| <h2>Installation complete! Try these next steps</h2> |
| <ul> |
| <li> |
| <h3> |
| <strong>Call additional SDK methods in your code</strong> |
| </h3> |
| <p> |
| Use |
| <code>dataClient</code> |
| or |
| <code>dataClient.monitor</code> |
| to call SDK methods: |
| </p> |
| <div id="collapse"> |
| <a href="#client_collapse" class="btn" data-toggle="collapse"><i |
| class="icon-white icon-chevron-down"></i> Details</a> |
| </div> |
| <div id="client_collapse" class="collapse"> |
| <ul> |
| <li><code>dataClient</code>: Used to access the data |
| methods of the App Services SDK, including those for push |
| notifications, data store, and geolocation.</li> |
| <li><code>dataClient.monitor</code>: Used to access the app |
| configuration and monitoring methods of the App Services SDK, |
| including advanced logging, and A/B testing.</li> |
| </ul> |
| </div> |
| </li> |
| <li> |
| <h3> |
| <strong>Add App Services features to your app</strong> |
| </h3> |
| <p>With App Services you can quickly add valuable features to |
| your mobile or web app, including push notifications, a custom |
| data store, geolocation and more. Check out these links to get |
| started with a few of our most popular features:</p> |
| <ul> |
| <li><strong><a |
| href="http://apigee.com/docs/node/8410">Push notifications</a></strong>: |
| Send offers, alerts and other messages directly to user devices |
| to dramatically increase engagement. With App Services you can |
| send 10 million push notification per month for free!</li> |
| <li><strong><a |
| href="http://apigee.com/docs/node/410">Geolocation</a></strong>: Keep |
| your app highly-relevant by targeting users or returning result |
| sets based on user location.</li> |
| <li><strong><a |
| href="http://apigee.com/docs/node/10152">Data storage</a></strong>: |
| Store all your application data on our high-availability |
| infrastructure, and never worry about dealing with a database |
| ever again.</li> |
| <li><strong><a |
| href="http://apigee.com/docs/node/376">User management and |
| authentication</a></strong>: Every app needs users. Use App Services to |
| easily implement registration, login and OAuth 2.0-compliant |
| authentication.</li> |
| </ul> |
| </li> |
| <li> |
| <h3> |
| <strong>Check out the sample apps</strong> |
| </h3> |
| <p>The SDK includes samples that illustrate |
| Apigee features. To look at them, open the .xcodeproj file |
| for each in Xcode. You'll find the samples in the following |
| location in your SDK download:</p> <pre> |
| apigee-javascript-sdk-master |
| ... |
| /samples |
| </pre> |
| <div id="collapse"> |
| <a href="#samples_collapse" class="btn" data-toggle="collapse"><i |
| class="icon-white icon-chevron-down"></i> Details</a> |
| </div> |
| <div id="samples_collapse" class="collapse"> |
| <p>The samples include the following:</p> |
| <table class="table"> |
| <thead> |
| <tr> |
| <th scope="col">Sample</th> |
| <th scope="col">Description</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td>booksSample.html</td> |
| <td>An app for storing a list of books that shows |
| Apigee database operations such as reading, creating, and |
| deleting.</td> |
| </tr> |
| <tr> |
| <td>messagee</td> |
| <td>An app for sending and receiving messages that |
| shows Apigee database operations (reading, creating).</td> |
| </tr> |
| <tr> |
| <td>monitoringSample.html</td> |
| <td>Shows basic configuration and initialization of the |
| HTML5 app monitoring functionality. Works in browser, |
| PhoneGap, Appcelerator, and Trigger.io.</td> |
| </tr> |
| <tr> |
| <td>readmeSample.html</td> |
| <td>A simple app for reading data from an Apigee |
| database.</td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </li> |
| </ul> |