Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / All-Topics

Building cross platform Mobile Applications using Apache Cordova – Part 1

5.00/5 (1 vote)
8 Sep 2015CPOL4 min read 5.1K  
Building cross platform Mobile Applications using Apache Cordova – Part 1   Apache Cordova is an open source platform for building cross platform mobile applications that runs on several mobile devices including iPhone, Android, Blackberry, Windows etc. Cordova facilitates writing … Continue r

Introduction

Apache Cordova is an open source platform for building cross platform mobile applications that runs on several mobile devices including iPhone, Android, Blackberry, Windows etc. Cordova facilitates writing code in one language and enables it to ship to several mobile devices and platform very easily. Cordova significantly reduces development efforts in order to build cross platform mobile applications. all these features, makes Cordova very special and popular. 

The Problem

First of all, building a cross platform mobile application is difficult. It takes a lot of time and effort to build and maintain a cross platform application. each of the mobile operating system has its own language and API that you need to understand and build your application, which is not easy and takes a lot of time.

so, we e need a solution that solves our problem and gives us freedom to use our existing skills and build something quick that works on all the major mobile operating systems and serve to our need,

Apache Cordova does exactly this, it gives you the ability to use your existing HTML and  JavaScript knowledge along with providing OS specific APIs that you can build your applications on top of, then compile it for targeted platform and achieve cross platform application development experience with very little effort.

this strategy saves you a lot of time and energy involved in building cross platform applications.

History

Before Apache Cordova came into existence PhoneGap was conceptualized and developed during iPhone Dev Camp in 2008. PhoneGap’s first stable release was in 2009 followed by version 1.0 in 2011.

PhoneGap was developed by a company called Nitobi, which was later acquired by Adobe. it was Adobe who denoted PhoneGap to Apache foundation and named it Apache Cordova.

since its inception, Apache Cordova has been supported by big names and companies and has been open source. there is wide community that supports Apache Cordova and regularly maintains it. and that’s why it is so popular platform to build cross platform mobile applications.

How does Apache Cordova work?

Apache Cordova has two major components, the first one launches your HTML application inside mobile browser and second one lets you interact with mobile specific hardware and APIs through your JavaScript code.

It all starts with instantiating a native shell which in turn starts a mobile browser inside a Mobile App and signals browser to launch the HTML that was packaged with your Mobile App. and that’s how your application runs inside a mobile in general. For most of the part, Apache Cordova is responsible for hosting your HTML app inside its shell and also lets your interact with device specific APIs needed by your application.

Apache Cordova supports variety of APIs that your can use in your application to interact with device and use its features. the API list pretty much covers all the major features of all major mobile devices so you are covered if you don’t require any other custom feature that you don’t intent to use in your Mobile App.

On a high level, it supports, Battery Status, Camera, Console, Contacts, Device, Accelerometer, Compass, Dialogs, File System, File Transfer, Geolocation, InAppBrowser, Media, Media Capture, Splash Screen, Vibration and StatusBar. In my personal opinion most of the business applications require only these features to achieve their goals and fits perfectly for most of the business cases.

Why Apache Cordova?

There are several reasons to choose Apache Cordova as a go to platform for building Cross platform mobile applications.

  • I will start with Simple application where actual native feel is not important.
  • since you can build application using your existing HTML and JavaScript coding skills, learning a new skill set is not required.
  • fits the bill when you want to go to market early, without waiting for months to be able to ship your application on all major platforms.
  • when you want to reuse your existing apps to ship as a mobile app.

you wouldn’t want to choose Apache Cordova when you are very concerned about look and feel of the application or if you have complex UI and need custom API usage. Speed is consideration, only when you are doing some heavy processing or data processing on client side, in that case you wouldn’t want to go ahead with Cordova.

Ok, so far we have seen what Apache Cordova is, its background and how it approaches cross platform mobile app development.

this was part 1 of my series on building cross platform mobile application using Apache Cordova.  Stay tuned for next part where I will talking about development options, environment, a simple Hello World App and much more.

Thanks and Happy Coding!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)