Hi mobile developers, in this post I would like to explain step by step how to install Cordova. Cordova, is a framework which you can use to develop mobile application. The official documentation on how to install the framework on Windows Development as for today, is worst.
Download nodejs from http://nodejs.org/download and make sure that you have the following path in your Environment Variables as shown below:
Step 2: Install the latest Cordova version using CLI (Command Line Interface). Type the following at command prompt to install cordova from the server repository:
C:> npm install -g cordova
3) Create an empty folder, then open command prompt and navigate to the folder using ‘cd’ command.
For example if you have created a folder called ‘MyProject’ at ‘C:\MyProject’. Then you can type the following at the command prompt:
Then next, type the following command to create the project template
C:\MyProject>cordova create hello com.example.hello HelloWorld
Navigate to the directory ‘hello’ by typing the following at command prompt:
4) Define the OS you want to support. For windows phone 8:
C:>MyProject>hello>cordova platform add wp8
5) Install plugins (If needed). For example we want the following plugins to be installed for development:
cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.camera
cordova plugin add org.apache.cordova.media-capture
cordova plugin add org.apache.cordova.media
Note: list of other plugins can be obtained from here: https://build.phonegap.com/plugins
6) Finally, generate our Windows Phone 8 cordova template by using this command:
C:>cordova build wp8
From step 6, if you got an error, Make sure to put the following path
in the User Environment OR System Environment as shown below.
Step 7 ) After you have built the wp8 template, you can straight away open it (HelloWorld.sln) up as shown here:
8) Then, finally you can export your own template from the visual studio 2013 by using the template export from the File Menu. Whenever you want to build your application using Cordova next time, you don’t have to follow all this steps again.
Step null) Lazy to follow this tutorial? Grab the working template here: CordovaWP.zip
and copy the zip file (no need to extract) to
C:\Users\[Your Username]\Documents\Visual Studio 2013\My Exported Templates\
After that you can create a new cordova project from Visual Studio template.