blog

Home / DeveloperSection / Blogs / Creating first Application Using Cordova

Creating first Application Using Cordova

Anonymous User2119 17-Apr-2017

Once you have install and setup Cordova into your system, you are ready to build an app .In this post you will learn to create an application using Cordova from scratch.

Also Read: How to install Apache Cordova

Step 1 - Creating App

First, open the directory where you want the app to be installed in command prompt. I have created it on desktop.

C:\Users\username\Desktop>cordova create CordovaProject io.cordova.hellocordova CordovaApp

 

WHERE

  • CordovaProject is the name of the directory where the app is created.
  • io.cordova.hellocordova is the reverse domain value by default. You should use your own domain value.
  • CordovaApp is the name of the application.

Step 2 - Adding Platforms

Open the project directory in command prompt. In the example it is CordovaProject. You should choose only the needed platform. You have to install the particular SDK platform in order to use it. Since I am using windows, I will use the following platforms. I have also installed Android SDK so we will only install android platform.

C:\Users\username\Desktop\CordovaProject>cordova platform add android

 

 

The other platforms that can be used on windows OS are as follows:

C:\Users\username\Desktop\CordovaProject>cordova platform add wp8

 

 

C:\Users\username\Desktop\CordovaProject>cordova platform add amazon-fireos

 

 

C:\Users\username\Desktop\CordovaProject>cordova platform add windows

C:\Users\username\Desktop\CordovaProject>cordova platform add blackberry10

 

 

C:\Users\username\Desktop\CordovaProject>cordova platform add firefoxos

 

 

If you are developing on Mac, you can use –

$ cordova platform add IOS

 

 

$ cordova platform add amazon-fireos

 

 

$ cordova platform add android

 

 

$ cordova platform add blackberry10

 

 

$ cordova platform add firefoxos

 

 

You can also remove platform from your project by using –

C:\Users\username\Desktop\CordovaProject>cordova platform rm android

 

 

Step 3 - Building and Running

In this step we are building the app for the specified platform so we can run it on mobile device or emulator.

C:\Users\username\Desktop\CordovaProject>cordova build android

 

 

Now we can run our app. If you are using default emulator you should use –

C:\Users\username\Desktop\CordovaProject>cordova emulate android

 

 

If you want to use external emulator or real device you should use –

C:\Users\username\Desktop\CordovaProject>cordova run android

 

 

NOTE – I am using ‘genymotion’ android emulator as it is faster and more responsive than the default emulator. You can download it from here. You can also use your mobile device for testing by using USB debugging function in you device’s USB settings and connecting it to your computer via a USB cable. You will also need to install USB driver for the specific device you are using.

Once you will run the app it will install it on platform you specified. If there are no any errors, the output must show the default start screen of the app as below.

Creating first Application Using Cordova


Also Read: Introduction to Apache Cordova


I am a content writter !

Leave Comment

Comments

Liked By