Apache Cordova overview
In this tutorial, an overview about Apache Cordova will be provided: what it is, how it is used in MobileFirst applications and what can be done with it.
What is Apache Cordova
Apache Cordova is an open source framework for mobile development.
The Cordova framework is integrated into all Mobile environments in IBM MobileFirst Platform Foundation (Android, BlackBerry 10, iOS, Windows Phone 8 and Windows 8).
Apache Cordova in MobileFirst Projects
The Cordova framework is automatically added to MobileFirst projects, for example in iOS and Android:
Getting device hardware and software information:
For detailed documentation and samples, see:
- Apache Cordova website - http://cordova.apache.org/
- Apache Cordova Wiki - http://wiki.apache.org/cordova/
Using native pages in hybrid applications
- Augmented reality
- Barcode scanner
- Opening a native contacts page
IBM MobileFirst Platform Foundation provides ways to augment your web application with native pages.
By using hybrid coding, the following actions can be performed:
- Navigate freely between web and native pages
- Share data between pages
- Share a single server session
- Implement your own functions by creating Apache Cordova plug-ins
The ability to add native pages to a web application is readily available for the iOS, Android and Windows Phone 8 platforms.
A basic scenario then is:
A developer writes one or more native pages.
A developer writes one or more web pages.
With the IBM MobileFirst Platform Foundation web API, it is possible to navigate between native and web pages, and data can be transferred back and forth.
Native API is provided to be able to communicate with the MobileFirst Server from the native page.
Cookies are shared between web and native, providing seamless client-server integration.
The web page invokes the native class
className, with the parameter
data, and calls the callback function on return. Example:
The following tutorials explain how to integrate native pages in hybrid applications.
Extending hybrid functionality with Cordova plug-ins
In some cases, a native page is not required, but native actions are still required to be performed using native code.
Examples might be:
- Using a native third-party library that is embedded in the application
The solution for such UI-less native functionality is to implement a Cordova plug-in.
The following tutorials explain how to add native functionality to hybrid applications.