Apache Cordova: Powerful Framework for Hybrid Mobile App Development
The Objective of this article is to provide hybrid mobile application development approach for mobile platforms using one of the most powerful open source framework : “Apache Cordova”. It will give us a readymade cooked platform for creating and hosting mobile applications on major platforms like android, ios,windows, blackberry etc.
Apache Cordova – History
Brief history: PhoneGap was an open source project started by a company called Nitobi. After sometime Adobe had purchased Nitobi because the ongoing PhoneGap project had many major contributors from top companies like IBM, Salesforce etc., hence after sometime Adobe donated the PhoneGap codebase to the Apache Software Foundation (ASF) for incubation purpose. At Apache Software Foundation (ASF) it re-branded as Apache Cordova. So at present Apache Cordova is the core open-source project where development and contribution happens. Apache Cordova is now the destination for those developer who is interested in contributing to this open source project. Below diagrams explains its history.
What are Hybrid Apps?
Top Hybrid Apps : Amazon Appstore, Twitter, Apple App store, Instagram, Gmail, Uber, Linked-In etc.
What are Native Apps?
A native app is a smartphone application developed specifically for a targetted mobile operating system
- Using Objective-C or Swift for iOS Platform
- Using Java for Android Platform
- Using .NET for Windows Platform
Top Native Apps : Facebook, Angry Birds etc.
Hybrid Apps “OR” Native Apps?
We can compare hybrid and native apps based on below standard features. This comparision sheet will help web/mobile developers to take quick decisions wheather native app or hybrid app for their clients.
Gartner view about Hybrid Mobile Apps
According to Gartner, Inc.
- Gartner Says by 2016, More Than 50 Percent of Mobile Apps Deployed Will be Hybrid.
- By 2017, 25 percent of Enterprises will have an enterprise app store for managing corporate-sanctioned apps on PCs and mobile devices.
Gartner’s Magic Quadrant 2013
As per Gartner’s Magic Quadrant 2013 for mobile application development platforms below Adobe’s PhoneGap API “OR” Apache Cordova is one of the Market Leaders in this space.
Gartner’s Magic Quadrant 2013 for mobile application development platforms is shown below
What is Apache Cordova?
Apache Cordova can be conceptulaized from below workflow diagram.
As we know apache cordova apps uses same web view used by the native operating system. Below is the web view class mapping with the respective platforms
- Platform iOS>> Objective-C UIWebView class
- Platform Android>> android.webkit.WebView
- Platform WP7>> WebBrowser
- Platform WP8>> WebBrowser control (Internet Explorer 10)
- Platform BlackBerry>> WebWorks framework
Apache Cordova Architecture
Apache Cordova Directory Structure Template
How to Create First Hybrid Mobile Application ?
below are the steps provided to create our first hybrid mobile application for android and ios platforms.
Create the Hybrid App Go to the directory where you want to create your project, and run this command : $ cordova create myApp com.test.app.myApp HelloWorld Add the required Platforms ( **Android/iOS/Windows etc.**) $ cd myApp $ cordova platform add ios ( to add ios platform) $ cordova platform add android ( to add android platform) Compile and Build the hybrid App $ cordova build ( default option, it will build all available platforms) $ cordova build ios/android (choose any specific platform to build) $ cordova prepare ios/android (choose any specific platform to prepare $ cordova compile ios/android (choose any specific platform to compile) Test or Run the App on an Emulator or Device $ cordova emulate android (to emulate on android default emulator) $ cordova emulate ios (to emulate on ios default emulator) $ cordova run android (to run on default connected android device) $ cordova run ios (to run on ios default connected ios device)
How does Apache Cordova work?
Getting Started with Hybrid Mobile App development
We need the tools below to start hybrid application development using apache cordova for mobile platforms.
Integrated Development Environment (IDE)
- Java IDE like IntelliJ for Android OR Jboss Developer Studio or Eclipse Mars
- Xcode for iOS
Mobile Platform SDK
- Android SDK 23
- iOS SDK
Apache Cordova: Cordova modules and Plugins are available over here https://cordova.apache.org/plugins/
- Recommended for deployment/testing
- Emulators are alternative but not a 100% true test
Getting Started Guide
Guide is available over here https://cordova.apache.org/docs/en/5.4.0/index.html