In this article, we will set up an environment for development of Windows Phone Applications using PhoneGap.
Start with Downloading PhoneGap from github. After downloading the file, extract its content and open the lib folder:
In the Lib folder open the Windows folder:
From the Windows Folder copy the zipped file CoroDovaStarter to the folder:
C:\Users\username\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#\Silverlight for Windows Phone
Note: If you do not have the Silverlight for Windows Phone folder then create it inside the Visual C# folder.
Now open Visual Studio and create a new project; you should have a new project template named CordovaStarter:
If you want to create a Windows Phone Application using PhoneGap and other web technologies then you need to select the CorodovaStarter template. Let us begin by selecting this template and creating a Hello World Application. After creation of the project, examine the Solution Explorer; you will find a folder created with the name www:
All the scripts on the page are executed when the device becomes ready. The Readiness of the device can be:
All the scripts should be written in the deviceready function:
If you run the application after making the above changes, you should be getting the following output:
Eventually index.html should have the code as below:
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8"/>
// once the device ready event fires, you can safely do your thing! -jm
"This is my first cordova/PhoneGap Application"
console.log("onDeviceReady. You should see this message in Visual Studio's output window.");
As of now we have set the environment to develop Windows Phone applications using PhoneGap or Cordova. In a futire article we will explore other capabilities and features of PhoneGap or Cordova.