Producing applications that run on multiple platforms has never been easy, which is why desktop-native applications have tended to target only one or two platforms at a time. In the past several years, developers have broadened their platform reach by writing to the Web browser, a trend that’s allowed for more platform diversity.
It’s no surprise, then, that developers targeting the mobile device space, which is blessed (or cursed) with much greater platform diversity than we see on the desktop, have looked to Web technologies to stretch a common code base to reach as many users as possible.
Among the more popular tools for pulling off this Web-powered multi-device strategy has been PhoneGap, an open-source mobile-development framework from Nitobi Software, which Adobe acquired in October. When Adobe announced the acquisition, the company said it planned to donate the PhoneGap code base to Apache, where the project will go by the name Project Cordova. (It was briefly named Project Callback.)
PhoneGap 1.3 began shipping in December, with Windows Phone 7 support as its headline feature. WP7 joins iOS, Android, BlackBerry, WebOS, Symbian and Bada in the PhoneGap-supported platform lineup.
The PhoneGap approach enables developers to target multiple platforms via familiar Web technologies, while still accessing native features otherwise not easily available to Web-based applications, such as accelerometer, camera or geo-location features. For a rundown of the features supported on each mobile platform, visit PhoneGap’s site.
However, a gap remains-if you will-between what’s achievable with PhoneGap and with a fully native development approach, particularly regarding the look and feel of an application targeted at multiple platforms, versus an application using native controls. Also, the speed with which a device can render the Web elements can be an issue, depending on the vintage of the device. With that said, the approach is well worth investigating further, particularly for corporate applications for which broad device support is a top priority.
Putting PhoneGap to the Test
I tested PhoneGap 1.3 for WP7 on a Windows 7 notebook outfitted with Visual Studio 2010 and the WP7 software development kit. From the phonegap.com/start, I downloaded a project template for WP7 that got me up and running with a basic application comprised of HTML, CSS and Javascript with WP7-specific wrapper code from PhoneGap.
The trickiest part was getting the WP7 emulator running properly. The emulator would start up, but in order get any applications working, I had to locate and install a Windows Display Driver Model 1.1 (WDDM 1.1) for the graphics adapter in my test notebook.
On my regular Linux notebook, I configured the Eclipse integrated development environment (IDE) with the Android SDK and PhoneGap’s Android-specific wrapper code, and was able to use the same basic HTML and associated files from my WP7 project with Android’s emulator.
For both platforms, setting up a development environment was easy enough, but for an even simpler development path, I tried PhoneGap Build, a Web-based service that provides developers with a one-stop location for building and hosting PhoneGap applications. I created an account on the service and uploaded the code for a test application that would show off PhoneGap’s integration with smartphone-native location services.
For my Android device, the process couldn’t have gone more smoothly. After I uploaded my code, the service kicked off builds for Android, BlackBerry, WebOS and Symbian. The service does not yet support WP7, and iOS builds, even for testing, require a signing key from Apple. The service includes facilities for uploading signing keys for Android and BlackBerry as well, although these aren’t required for test builds.
When the builds were complete, I downloaded the Android and BlackBerry files the service generated, and emailed them to my devices. The Android build installed without a hitch. (I’d previously enabled installation of unsigned binaries on this device.) However, the BlackBerry installer threw an error. It turns out that I had to download the BlackBerry installer directly from my test application’s public page on the service, and the application installed.
PhoneGap Build is free for a single developer with one private application and unlimited public applications. The service offers three paid pricing tiers, which range from $12 to $90 a month, and allow for more private applications and project collaborators. The PhoneGap blog provides additional price information.