Open In App

What is Apache Cordova?

Last Updated : 10 Nov, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

Apache Cordova is an open-source platform for developing mobile apps through web applications like HTML, CSS, JavaScript. Cordova is very useful to web-developers as they can turn their web pages to a web app with native app functionalities easily using Cordova. This is an extremely helpful feature as normal web apps don’t have this functionality.

Cordova is used to making cross-platform mobile applications and provides a wide range of plugins for better functionality of the app which is easy to embed.

Installation 

We are installing the Cordova command-line tool. If not already installed follow the steps given below :

  1. Download Node.js and install it from here.
  2. Using npm utility(Node.js) to install Cordova module

Installation on Linux / macOS

Prefixing the sudo command to the npm command might be needed to install the utility

$ sudo npm install -g cordova

Installation on Windows

The -g flag tells the npm utility to install Cordova globally

C:\>npm install -g cordova

Run Cordova in the command line to check if properly installed if installed it should print help text.

Cordova’s Application Architecture 

Cordova has a high-level design the diagram shown below depicts its architecture 

Cordova's application architecture

Cordova’s application architecture

Web View: This is the user interface of the Cordova application. The applications used are integrated with the web view and the native components(for hybrid apps).

Web App: This is the basic web page layout made using HTML, CSS, JavaScript. This is the core of the Cordova application the web app runs in the web view. The file config.xml is responsible for the information on the app 

Plugins

Plugins are one of the best features in Cordova. Integrating plugins adds apps functionality and attractiveness.  Cordova maintains a set of plugins called Core Plugins which provides application capabilities like Camera, Battery, File transfer etc. In addition to the core plugins, there are several third-party plugins that provide additional bindings to features. Cordova does not provide any mv framework or widgets. Plugins are necessary for functionality like communication between Cordova and custom native components. Plugins can be searched using the npm command or searched at the link given below

Development Paths

Basically there are two development paths in Cordova each with its own advantages :

  1. Cross-Platform Workflow: This workflow is centered around the command-line interface(CLI) and mostly used when a developer wants the application to run on different platforms. This workflow has very little need for platform-specific developments. Here the CLI copies assets of different platforms into sub-directories for each of the platforms and has a common interface to apply plugins.
     
  2. Platform-centered Workflow: This workflow is centered around lower-level shell scripts for a specific platform and is used when a developer is focused on building an application on a single platform and wants to modify it at a lower level like adding native components to the web-based components. This workflow does not have any high-level tools. If a user wants to modify the application with SDK the Platform-centered workflow is used

Features :

  1. Command Line Interface: Used for installing plugins and writing commands to build a Cordova application
  2. Cordova Plugins: Many APIs can be used in Cordova to add functionality to a Cordova application
  3. Cordova Core Components: A set of components used to build the application

Advantages of using Cordova

  1. Easy to use and does not require a lot of time to make an application with Cordova.
  2. There is no need to learn a specific development programming language to develop an application.
  3. Cordova follows a plugin architecture, many plugins to work with which can be added and modified. We can enable and disable plugins as per our priorities.
  4. Is a platform for developing an application that can be used in different platforms — Ubuntu, Windows, Blackberry, etc.

Limitations

  1. Not all plugins are compatible with every platform.
  2. Hybrid apps are slower than native apps.
  3. Not optimum for making an application that requires a large set of data.

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads