Developers Club geek daily blog

2 years, 10 months ago
In this article I will acquaint you with a framework for web developers — Cordova which allows to develop mobile applications for several platforms at once.
Introduction to Cordova: Bases

We start a series of articles — Introduction to mobile development of web applications on Cordova, and we will begin with bases.
If you do not know that you such Cordova and want to understand whether to be useful this tool for your following project, here I will try to answer frequently asked questions:
  • What is Cordova?
  • How works under a cowl?
  • What will be able I to create with Cordova?
  • How to me to begin to work with Cordova and what is required to me?

What is Cordova?

Cordova — a platform of development of mobile applications which first of all is intended for web developers. She allows web developers to use web technologies, such as HTML, CSS, and JavaScript, for creation of mobile application. As well as any other technology, at Cordova has pluses and minuses.


  • Simple in studying if you are web developer, then you cannot understand work of this framework. You will be able easily to apply the skills as the web developer to create proprietary mobile application with Cordova. Everything that to be necessary for you, it to get acquainted with the command line.
  • Access to native functionality, you will have an access to the majority to functions of the device, it as the camera, contacts, a geolocation, media, the SMS and many other things.
  • Free of charge, framework completely free.
  • Open source code, any will be able to make the changes to the source code Cordova to make it it is even better. Additional plug-ins also have an open source code, thanks to it you will have an opportunity own.
  • The big community, a large number of developers use Cordova, on Stack Overflow there are about 40,000 questions on Cordova. It means that to you will be able always to help to solve any problem (if they at you in general appear).
  • Write once, develop in any place, Cordova compiles your application in the special file of a packet which will be suitable for the majority of app stores. It means that applications which you will develop with Cordova can be added easily to any App Store at your choice. If you develop under Android, Cordova creates APK (Android application package) the file. If you develop under iOS, Cordova will compile IPA. For Windows it is APPX.


  • Bad documentation, it is difficult to find information on specific things, for example, what packets need to be set together with SDK Android manager. And when you look for something, results will be on different Cordova versions. It sometimes confuses beginners as they set one Cordova version, and they look at documentation for other version.
  • More slowly than native applications, as the applications created with Cordova — generally web applications which work with web view, they not so fast as native applications. It means that there are certain restrictions at an application creation. For example, it is better to make the application of editing video native as for work, it spends CPU and GPU more.
  • Frameworks as Cordova — just the wrapper for a web application, in it is not present components of the user interface, animations and others useful tools which would be useful for the majority of applications. It means that you will have to implement them independently. Therefore many developers use Ionic or Onsen UI for creation of the user interface in the applications.
  • Errors in plug-ins, not all plug-ins work ideally, in some there are errors and they work not as it was expected.

Cordova and PhoneGap

During the work with Cordova you will often face the term PhoneGap. PhoneGap — the free open-source created by Nitobi Software approximately in 2009. In 2011 the company was purchased by Adobe.
Pay attention that Adobe did not buy development but only a name and people who worked in Nitobi. The project was open source transferred to Apache Software Foundation which is known as Cordova now.
In practice of PhoneGap and Cordova — generally same. You can select PhoneGap or Cordova during creation of the project. The only difference — CLI (Command line interface). CLI PhoneGap it is integrated with Adobe PhoneGap Build. This service allows developers to compile the applications, uploading it on the PhoneGap Build website.

How Cordova under a cowl works?

The user interface Cordova is a web representation (web view). Web representation, it like a tab in the browser. When you compile the application, Cordova does not work with your HTML, CSS, and JavaScript a code, and transforms it to native code which in an effect will be defined for each platform.
Cordova works as the container for the application in which you use web technologies. When the application is compiled, your code remains invariable. The compiler just takes your code and makes it available for rendering in web representation.
It practically too most that to open the HTML file in the browser. But keep in mind that web representation is implemented differently on each device. It means that there are certain functions which will not be available on some platforms, or they are implemented in a different way.

Native functions of the device

With Cordova, by means of plug-ins, you will have an access to native functionality of the device. Plug-ins are additions which represent JavaScript API for own components. They allow you to get access to native opportunities of the device, using JavaScript API.
You of course already guessed that plug-ins are created separately. It means that at first it is necessary to set SDK for the necessary platform, only then you can begin development for the necessary platform. Then you cause native code through JavaScript API that it was possible to get access in web representation to it.
There are two types of plug-ins which you can find in Cordova. The first — official plug-ins. They are in community Cordova. All official plug-ins have cordova-plugin prefix.
Other type of a plug-in — the user plug-ins. They are created by developers such as you and I. Often they are created, for a solution of a certain problem, for example integration of the application with Facebook or Ionic Keyboard Plugin, for simple interaction with the keyboard.
You can look at more information on plug-ins on the website Cordova Plugins.

What will be able I to create with Cordova?

By means of Cordova, you can create substantially any kind of the application, of course there are some restrictions about which we will talk later. Let's look at demonstration applications which you can create with Cordova.
  • TripCase — the application for travel.
  • FruitSalad — game puzzle.
  • Panasonic World Heritage Calendar — the calendar application which shows you beautiful photos of objects of the World heritage.
  • HealthTap — questions about health on Stack Overflow.
  • Wikipedia — the official application of Wikipedia is created on Cordova.

Now you will have an approximate submission of your application which you will be able to create with Cordova. If you — the developer, then most likely noticed that all applications use the Internet. All of them contact a remote server, for data collection. It is one of functional features of Cordova, data collection from the server, display to their user and transfer of the return answer from the user.
It does not mean that you will not be able to create autonomous applications with Cordova. There is a set of solutions for the client database which you can freely use in the application. The most popular — LokiJS, the fast, dokumento-oriented data storage in memory for Node.js, browsers and Cordova. For example for the application of a photo gallery, you could use this library to save a way of photos, and then to sgrabit if necessary.
With Cordova you will be able to use any CSS or JavaScript library as all code is executed in the browser. But be careful, not all browsers identical. And it transfers us to the following section.


As well as in many technologies, there are always restrictions. Cordova not an exception. In this section I will tell about some restrictions of Cordova.


Cordova provides access to devices thanks to plug-ins which spend resources, such resources which native applications do not mention. As it was mentioned in this manual earlier, bad idea to create the application with Cordova which will strongly rely on CPU or GPU. Such applications will not be productive, in comparison with native.

Existence of plug-ins

If you could not achieve a certain functionality through the existing plug-in in repositories, then your only choice — to create a plug-in independently.

Web representation (Web view)

By default Cordova uses web representation of a platform for rendering of the user interface, it means that you interact with different web representations in each platform.
Besides, different versions of an operating system of a platform, can have a different web representation or identical, but with different feature set. For example, modern Android of the device have support the WebRTC function while in older Android versions there is no such function.
Therefore new projects, such as Crosswalk come to the rescue. Crosswalk allows you to use the user web representation in the Cordova applications, normalizing distinctions between platforms.

This article is a translation of the original post at
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here:

We believe that the knowledge, which is available at the most popular Russian IT blog, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.

comments powered by Disqus