user1619480
user1619480

Reputation: 543

Cordova/phonegap windows phone plugins

I am having problems getting a phonegap windows phone app up and going. (PhoneGap 3.1.0 - on a windows 8 machine)

I have followed the step so create a windows phone app from the “Windows Phone Command-line Tools”. It says to use CordovaWP7xxx.zip + CordovaWP8xxx.zip to create a template and you can create an application from this. There is no phonegap download in the latest 3.1.0 version of phone gap. I was able to find these templates in the cordova download so I used them instead.

I successfully created and run a project through visual studio using the following command format .\wp7\bin\create PathToNewProject [ PackageName ] [ AppName ]

The problem I am having is that I cannot install any plugins to this application. When I try with the phonegap command

C:\Phonegap\ReflectionPGWP7>phonegap -d local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

I get the following error

[error] project directory could not be found

When I try with the cordova command cordova plugin add org.apache.cordova.device

I get the following error

[Error: Current working directory is not a Cordova-based project.]

In both scenarios the command prompt is directed at the folder of the application.

I would be grateful for any tips on what might be causing the issue and potential workarounds. The documentation is inconsistent and I have try several other things to get this going but would welcome suggestions on the best way forward.

In short: has any got phone gap going with windows phone 7 with plugins i.e. notifications. Would love to hear how others got it going Thanks

Upvotes: 0

Views: 3587

Answers (2)

user1619480
user1619480

Reputation: 543

So I got it going in the end. Must say the documentation regarding this on phonegap was lacking at the time of writing this. It contradicted how you should create an application. However for those that want it, here is how is how I got it going in the end. First I installed phone gap.(see website) Then I created my application from the command line like so:

    C:\Phonegap>phonegap create C:\phonegap\ReflectionPGWP7 
io.reflection.ReflectionPGWP7 ReflectionPGWP7

Changed directory

C:\Phonegap>cd ReflectionPGWP7

Then I looked to install the plugins:

C:\Phonegap\ReflectionPGWP7>phonegap -d local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

I got an error

[error] Error fetching plugin: Error: "git" command line tool is not installed: make sure it is accessible on your PATH.

So I installed github installer: http://windows.github.com/ And re ran my plugin and it worked. You can find all the plugins from the add features section on this page http://docs.phonegap.com/en/3.0.0rc1/guide_cli_index.md.html#The%20Command-line%20Interface Then I ran

phonegap local run wp7

But got the error

    [error] An error occured during creation of wp7 sub-project. 
platformRoot = C:\Users\Controlling change\.cordova\lib\wp\cordova\3.1.0\wp7

So I went to that directory above that C:\Users\Controlling change.cordova\lib\wp\cordova\3.1.0 and ran createTemplates.bat and rerun it. And it compiled it up and ran it in an emulator.

All in all it is quite straight forward

Upvotes: 1

gaqzi
gaqzi

Reputation: 3797

Try creating the project by using the phonegap command:

phonegap create foldername

Then add the wp8 platform and the plugins you need

phonegap add platforms wp8
phonegap add plugins org.apache.cordova.device

Then put your own app files in the www folder. To build the project to phonegap local build which will also copy all your changes from the www folder into the platforms/wp8/ Visual Studio project.

Upvotes: 0

Related Questions