Blog

Sky Writing

Announcing PhoneGap Library

We are proud to announce the release of the Urban Airship PhoneGap library, which is available as of August 8, 2012. We are shipping the library with support for iOS and Android. This release wraps our existing libraries for both platforms, allowing users to easily embed Urban Airship in their applications. Wrapping our client libraries means that you can include push messaging, location history, and results reporting in your application using just a few lines of code.

Technical Details

To make it easier for you to use the library, the same JavaScript API is available for both iOS and Android, so you can use the same JavaScript code on both platforms, with little or no changes. The only differences are in a few functions due to minor quirks in how each platform handles sound and vibration preferences, badging, and initial registration. As a result, some functions are no-op’d as iOS only or Android only calls, but the majority are cross-platform.

Basic Example

We have followed modern JavaScript convention as much as possible in writing the API to take an asynchronous approach using events and callbacks. This style should be familiar to many programmers with JavaScript experience. The short example below illustrates this approach:

 


This is a brief but fully-functioning example that demonstrates the basics of what you can accomplish with the Urban Airship PhoneGap library. Please refer to our documentation for more information.

Getting the code

You can get the plugin, which includes a sample application for both iOS and Android, from our Resources page. These sample apps have a common code base and will behave in the same manner on both iOS and Android. While both use jQuery to make DOM interaction easier, nothing in our library requires that you have jQuery installed. The source code is also available on GitHub.

If you have questions or need support, please email us at support@urbanairship.com.

comments powered by Disqus

Questions? Call Us (800) 720-2098