What is Apache Cordova?

Apache Cordova is a platform that is used for building mobile apps using HTML, CSS, and JS. We can think of Cordova as a container for connecting our web app with native mobile functionalities. Web applications cannot use native mobile functionalities by default. This is where Cordova comes in. It offers a bridge for connection between web apps and mobile devices.

By using Cordova we can make hybrid mobile apps that can use the camera, geolocation, file system, and other native mobile functions. Apache Cordova is an Open Source project, that aims at letting mobile developers build applications for all major mobile platforms using HTML5 technologies.

Apache Cordova is available for the following platforms: iOS, Android, Blackberry, Windows Phone, Palm WebOS, Bada, and Symbian.

Who will use Apache Cordova?

When do we use Apache Cordova?

Use Apache Cordova if you are,

Why do we use Apache Cordova?

Apache Cordova’s architecture is extendable, and built around a plugin model. Anyone can create their own additional functionality for Cordova and publish it as a plugin. There are several components to a Cordova application.

The following diagram shows a high-level view of the Cordova Application Architecture.

 Cordova Application

Cordova Features

Cordova Advantages

Limitations

Developer Requirements

How do I install Apache Cordova?

Use the Visual Studio Tools for Apache Cordova to build apps that run on iOS, Android, and Windows devices.

To use these tools, choose the Apache Cordova feature when you install Visual Studio. If you've installed Visual Studio already, you can always add the feature later. You'll need a computer that runs Windows 8, Windows 8.1, Windows 10, or Windows Server 2012 R2.

You need the following things.

Method 1. Choose the Apache Cordova feature when you install Visual Studio

  1. In the Visual Studio installer, choose the Custom option, and then select the HTML/JavaScript (Apache Cordova) feature.
    Apache Cordova feature

Method 2. Add the Apache Cordova feature after you install Visual Studio, If you've already installed Visual Studio, just modify it to include the tools.

  1. Open Control Panel -> Programs and Features, choose the Visual Studio 2015 item and then choose the Change button.
    Open Control Panel
  2. In the setup wizard for Visual Studio, choose the Modify button.
  3. In the list of optional features to install, select the HTML/JavaScript (Apache Cordova) checkbox, choose the Next button, and then choose the Update button.
    Next button
  4. Visual Studio installs all of the third-party components that you need to build your app.
    Visual Studio installs

How do we build Apache Cordova Apps?

You can start building Mobile using Apache Cordova.

Now let's get started with the following steps.

Step 1. Create a Project.

Open Visual Studio 2015 and Click File -> New -> Project Option for New Apache Cordova App.

 New Apache Cordova App

Step 2. Giving the Project Name.

Then, a New Project Window will open, there you can select an Installed -> Template -> Java Script -> Apache Cordova Apps -> Blank App (Apache Cordova).

Type Project Name CordovaApp and click the OK button

Cordova

Step 3. Solution Bar.

After we create the project, our solution should resemble the following.

Solution Bar

This table gives the basic idea of how we might use each one.

File Why is it in your project?
bower.json This file manages the Bower package dependencies of our app.
build.json This file contains parameters that Visual Studio uses to build a signed Android package.
config.xml Contains the settings of our app.
taco.json Defines which version of the Cordova CLI Visual Studio is used to build the project.

Step 4. Run the Application.

Now we are ready to run our Project, So Click the Ripple – Nexus (Galaxy) to run the Application. (Apache Ripple is a free mobile simulator).

Run the Application

Output 1. Run on Nexus Galaxy.

Nexus Galaxy

Output 2. Android.

We can also run our app in Android, iOS, and Windows device emulators. To see them all, choose any platform from the platform list on the Standard toolbar.

Android

Conclusion

I hope you understand how to create an Apache Cordova App using Visual Studio and run it.