Appendix D. Using Cordova to Build Chrome Apps for Mobile Devices

Apache Cordova is a layer of software that provides HTML and JavaScript support so that an app written using those technologies can run under a native operating system. Of course, any modern browser can do that already, but Cordova provides the wrapping in the form of a native app, so the user who installs and uses it sees it as a native app.

Google’s Augmentation of Cordova

Google has added plug-ins to Cordova that implement the Chrome APIs, as shown in Figure D-1.

Cordova layers
Figure D-1. Cordova layers

Not all APIs are supported, although support is widening as time goes on. To see the current state of affairs, check the Mobile Chrome Apps page and the list of supported APIs.

Even though Cordova runs your app on Android or iOS, you can’t call any native Android or iOS APIs if you still want your app to run on Chrome—you can use only Chrome and HTML APIs.

Development Tools and Debugging for Cordova

Mobile devices ranging from phones to fairly large tablets have two important differences relative to desktop or laptop computers that will affect your user interface design:

  • The screen is usually smaller—for phones, much smaller. You need a layout that works on all screen sizes, or you can use CSS to implement a so-called “responsive” interface that adapts to the screen size. There’s lots of information on the web about how to do that; just ...

Get Programming Chrome Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.