Preview: Google's tantalizing Mobile Chrome App SDK

Google's new Cordova-based toolchain lets you develop hybrid mobile apps from the same HTML, JavaScript, and CSS code as Chrome apps

Page 2 of 4

Google Chrome meets Apache Cordova
PhoneGap started life as a quick hack at an iPhoneDevCamp event and eventually grew into a widely adopted open source project targeting multiple mobile platforms, under the auspices of Nitobi Inc. By 2009, PhoneGap apps ran on iPhone, Android, and BlackBerry. Adobe bought Nitobi in 2011 and contributed the PhoneGap code to the Apache Software Foundation to start a new project, Apache Cordova. Adobe PhoneGap is now a superset of Apache Cordova, in much the same way as Apple Safari and Google Chrome are supersets of WebKit.

In 2012, Adobe introduced PhoneGap Build, a subscription-based Web application that compiles PhoneGap HTML5/JavaScript/CSS3 projects into hybrid apps for various mobile platforms. The Cordova framework code itself continues to be free open source. Without PhoneGap Build, developers need to install and maintain the SDKs for all the mobile platforms they wish to target. With PhoneGap Build, the chore of maintaining the iOS, Android, and Windows Phone 8 SDKs locally can be avoided, and building for these three platforms becomes a matter of updating your project in GitHub and pushing a button. The latest PhoneGap Build does not support the other Cordova targets: Amazon Fire OS, BlackBerry 10, Ubuntu, Windows Phone 7, Windows 8, and Tizen.

It took me about two hours to install the Mobile Chrome Apps development kit and all its requirements on my iMac. I already had most of the major pieces installed, such as Node.js, the Android SDK, and Xcode, although I needed to do some updates and add Java and Ant to the Bash path. If you're starting from scratch, it may take you longer. If you already have all the prerequisites up to date, you may be up and running in less than an hour. If you're working on a Windows machine, you won't be able to build iOS apps, but you will be able to build Android and Chrome apps.

In addition to providing the application shell, Mobile Chrome Apps gives you access to many of the Chrome and Cordova APIs. The Chrome APIs include:

  • identity -- use OAuth2 access tokens to sign-in users without prompting for passwords
  • payments -- sell virtual goods within your mobile app
  • pushMessaging -- push messages to your app from your server
  • sockets -- send and receive data over the network using TCP and UDP
  • notifications (currently Android only) -- send rich notifications from your mobile app
  • storage -- store and retrieve key-value data locally
  • syncFileSystem -- store and synchronize files on Google Drive
  • alarms -- run tasks periodically or at a specified time in the future

The application shell gives a hybrid app retained state that isn't available to a mobile Web app. You can see the difference dramatically on your phone or tablet when you switch to a different app and then back. The hybrid app comes back the way you left it; the Web app doesn't.

MobileChromeApps and Android Developer Tools
Figure 1: At the left, we see the source code for the "Hello, InfoWorld" Mobile Chrome App in the Eclipse-based Android Development Tools; at the right, we see it running in an Android emulator. A single project supports a Chrome Web app, an Android app, and an iOS app.
| 1 2 3 4 Page 2
From CIO: 8 Free Online Courses to Grow Your Tech Skills
View Comments
Join the discussion
Be the first to comment on this article. Our Commenting Policies