This blog is about how to start with PhoneGap and Windows Phone 8.
With Windows Phone 8 the situation is a completely different one:
- Windows Phone 8 has no WinJS support for now
- There are many developers who have experience with PhoneGap and can create Windows Phone 8 application without additional effort.
Windows Phone 8 brings with it some new requirements.
What is new in Apache Cordova for Windows Phone 8
- Internet Explorer 10. Windows Phone 8 has a new browser! Internet Explorer 10 is the engine behind the WebBrowser control in Cordova for WP8, and this brings many enhancements. IE10 has MSPointer events. On WP8 you can access localStorage as a key/value dictionary without using a work-around from Apache Cordova for WP7.
PhoneGap developers could use the advantages if the new platform, described here.
How to Create PhoneGap applications for Windows Phone 8.
In Apache Cordova 2.3.0 there are two different types of templates:
The 'Stand-Alone' template includes ALL the source code for Apache Cordova. This project is easier to fine-tune to use just the features you need, thereby working around the permissions issues of the 'Full' template, however this type of project will be more difficult to update, as you will need to update individual files within your project and manage any dependancies yourself.
You can find both templates ( CordovaWP8App_2_3_0_Full or CordovaWP8App_2_3_0_Standalone) in the lib/windows-phone-8/ folder of the your distribution.
If you copy these templates to \My Documents\Visual Studio 2012\Templates\ProjectTemplates\Language\ folder (language in this case is a C# ) it will be possible to select it from the “New Project” dialog window.
The experiment with pre-built Project Templates
My experience has shown that predefined Cordova Windows Phone 8 templates not working correctly. The project file metadata (.vstemplate) file looks fine but I received errors when you tried to create a project from pre-built project templates
An alternative approach
If you have some issues using the pre-built templates you can build a new Cordova Windows Phone 8 project template/
Open one of the two projects \lib\windows-phone-8\templates\standalone\CordovaSolution.sln or \lib\windows-phone-8\templates\full\CordovaSolution.sln
In this demo will be used \lib\windows-phone-8\templates\standalone\CordovaSolution.sln
From the file menu, select 'Export Template...'
Choose template type 'Project template'
Give the exported template a name and set an icon image and a preview image.
Your exported template is available under \My Documents\Visual Studio 2012\Templates\My Exported Templates\ folder
Copy the zip file containing the template under \My Documents\Visual Studio 2012\Templates\ProjectTemplates\Language\ folder and select File->New Project..
Select your template (WP8 Cordova App Project in this sample).
You will have a completely new Cordova Windows Phone 8 project.
Build the project and run it.
Apache Cordova 2.3.0 now officially supports Windows Phone 8. If you have any issues with pre-built project templates just try to build it again from the template solutions.
Expect next blogs about about how to use PhoneGap with jQuery Mobile and Ignite UI.
Source code of the Windows Phone 8 PhoneGap sample application is available here.
You could download Visual Studio 2012 Windows Phone PhoneGap template from this link.
Follow news from Infragistics for more information about new Infragistics events.
As always, you can follow us on Twitter @mihailmateev and @Infragistics and stay in touch on Facebook, Google+andLinkedIn!