The Cordova Application rely on the common config.xml file. This file provides the information about the app and also specify the parameters that affect its working. It follows the W3C’s Packaged Web App.
By default, this application is implemented like a web page that named as index.html that references the resources (images, media files) necessary for running the application. The application executes as a Web View with the native application wrapper which can be distributed to the app stores.
A WebView provides user interface of a Cordova application and it can also be a component for some platforms within a larger, hybrid applications. These applications mix the WebView with the native application components.
This container consists a key file i.e., config.xml that are responsible for providing the information about the app.
Cordova creates an app, in which the web app is initialized in a WebView i.e., HTML Rendering Engine.
Basically, the Apache Cordova project defines a set of core plugins called Core Plugins. These plugins provide access to device capabilities in the application such as camera, battery, contacts etc.
How does it actually work?
When the application launches, firstly, Apache Cordova loads the application’s default startup page (usually index.html) in the application’s WebView and passes its control to the WebView. The WebView, allows the user to interact with the application by entering data in input fields, clicking on the action buttons, and viewing results in the application’s WebView.
Cordova Development Workflows:
You can follow two basic paths when developing the Cordova:
- Cross-platform workflow is used for deploying your application to different platforms with little or no platform-specific development. Cordova Command-Line Interface is defined as a tool that support this workflow and acts as a higher-level abstraction used for building your application compatible for different platforms.
- Platform-centered workflow is used for developing your application for a specific platform and helps to modify code at a lower level by mixing the native components with Cordova components.
Command Line Interface:
The Command Line Interface (CLI) is responsible for creating a new Cordova application and deploy it into various native mobile platforms. It is a text-based interface that mainly operates on various software and operating systems. We can also use CLI to initialize the project code for which you can use various platform’s SDKs to develop the app further.
If you want to add any support or rebuild your project for any platform, you must require to run the command line interface from the same machine which supports the platform’s SDK.
Basically, it is available on the Command Prompt under Accessories on the PC. It also maintains a remote source code repository through which you can run CLI from different machines.
The Command Line Interface consists some specific commands that are used to accelerate the mobile app development, testing, and deploying the app to various mobile platforms. It can also execute the commands for testing the hybrid mobile app with both real devices and emulators.
Before using the CLI tools, you must have to install the SDKs for each targeted mobile platform. These tools can quickly be used by installing it as a npm package.
What role does CLI play in Cordova?
The Apache Cordova is fully dependent on CLI. It can’t execute a single process without CLI. Basically, it is used in following cases:
- To create a Cordova project.
- To generate the APK.
- To add the plugins.
- To provide a platform where we can develop an app.