Difference between cordova and phoneGap
There is some confusion about phoneGap and cordova, as far as codebase is concerned there is no difference between them. Phonegap is a command that encapsulates cordova, major difference is that phonegap has a remote build capability known as phoneGap build whereas cordova supports local builds, you can find more information about this here. In this blog series I will create simple cordova application and add barcode scanner plugins to it.
Cordova command line tools are distributed as "npm package" that is node package manager.
Node has a powerful package manager i.e., npm which helps in downloading packages and their dependencies without much of a hastle. Once node has been installed, open the command prompt and type command (npm package manager will be installed along with node)
you should see all the commands possible with npm
Now you can install cordova using npm package manager.
execute following command:
npm install -g cordova
Guys behind proxy, to set proxy parameters ,execute following command :
now you can execute "cordova" command to see if it is installed properly, you should see all the cordova related commands.
Once cordova installation is confirmed, execute following command to create cordova project.
cordova create E:\programs\barcodeScanner com.enterprisemobility.barcodeScanner barcodeScanner
This command basically creates a cordova project at folder location "E:\programs\barcodeScanner" with name barcodeScanner and with the name space com.enterprisemobility.barcodeScanner. You can change these parameter names according to your convenient.
Now do "cd barcodeScanner" you should see the following folder structure
execute the command
cordova platform add android
this command adds specified platform (i.e., android) to the cordova project, in this case the Android platform. Make sure android SDK is in your "PATH" or else you will run into an error. Similarly if you are on a MAC system and have ios devtools, you can simply execute the command
cordova platform add ios
Let's run our cordova app on a device, make sure you are in a cordova app's root directory that is "barcodeScanner" folder and run following commands :
cordova run --device or cordova run --emulator
command will produce following output as in the screen shot
application should start on device if device is connected or else you should execute above command with --emulator option so that emulator gets opened. On device/emulator screen you can see default cordova app.
Thats it :) congratulations,you have created your first html5 app/hybrid app with cordova. In my next blog I will explain cordova folder structure in detail and customising the default app.
Customising default cordova/phoneGap app →