How to create Cordova Project ?

cordova create <app-directory-name> <unique-identifier> <appname>

<app-directory-name> is your foldername

<unique-identifier>

  • It’s called as Bundle ID (iOS) or Package name (Android)
  • Syntax -> com.yourcompany.yourappname

Example

cordova create QuizApp com.codesundar.quiz  QuizApp

How to add platforms ?

cordova platform add <platform name>
cordova platform add android
cordova platform add ios

How to remove platforms ?

cordova platform remove <platform name>
cordova platform remove android
cordova platform remove ios

you can also use

cordova platform rm android

How to add plugin ?

cordova plugin add <plugin-name>
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-facebook4

Note you can refer http://plugreg.com or http://cordova.apache.org

How to remove plugin ?

cordova plugin remove <plugin-name>
cordova plugin remove cordova-plugin-device
cordova plugin rm cordova-plugin-device

Directory / Folder Structure

  • QuizApp
    • Hooks
    • Platforms – platforms that you’ve added
      • Android
      • Ios
    • Plugins – plugins that you’ve added
      • Cordova-plugin-whitelist
      • Other plugins
    • www  – is your working directory (your app)
      • css
      • img
      • js
      • index.html – loads as home page
    • Config.xml – configurations for your app

About Config.xml

Config.xml is a global configuration file that controls many aspects of a Cordova application’s behavior. This platform-agnostic XML file is arranged based on the W3C’s Packaged Web Apps (Widgets) specification and extended to specify core Cordova API features, plugins, and platform-specific settings.

What can you do with config.xml ?

  • Change App name, developer information, home page of your application
  • Add Icons and splash screens
  • Add plugins & device specific functionalities
  • Change properties of your application such as fullscreen, orientation and more

Learn more :

https://cordova.apache.org/docs/en/latest/config_ref/

How to build your Cordova project

Build your application for all platform

cordova build

Build your application for specific platform

cordova build <platform name>
cordova build android
cordova build ios

Running your application on device / emulator (setup required)

run for all platform with a single command

cordova run

Run for specific platform

cordova run android
cordova run ios

How to Setup mobile / emulator ?

Step 1: Mobile Settings -> Scroll to bottom -> About Phone -> scroll bottom -> Click Build number for 7 times

Step 2: Mobile Settings -> Scroll to bottom -> Developer option ->  Enable Developer option & USB debugging

Useful Links:

Sundaravel M

About the author: Hey! It's me sundar. (Yea, I'm the founder of codesundar.com). I'm a passionate computer programmer who loves modern web and mobile development. feel free to reach me : Facebook - Twitter - Google+