Apache Cordova overview
This tutorial provides an overview of what you can do with Apache Cordova in your MobileFirst applications.
This tutorial covers the following topics:
- What is Apache Cordova?
- Apache Cordova in MobileFirst projects
- Usage samples
- Using native pages in hybrid applications
- Extending hybrid functionality with Cordova plug-ins
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:
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, you can perform the following actions:
- 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 MobileFirst 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 enable communication with 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:
Extending hybrid functionality with Cordova plug-ins
In some cases, a native page is not required, but native actions still need native code for their execution.
- Using a native third-party library that is embedded in the application.
The solution for such native functionality that does not require a user interface is to implement a Cordova plug-in.
The tutorials in the Adding native functionality to hybrid applications category explain how to integrate native pages in hybrid applications.▲