简体   繁体   English

Cordova / Phonegap Windows Phone插件

[英]Cordova/phonegap windows phone plugins

I am having problems getting a phonegap windows phone app up and going. 我在启动Phonegap Windows Phone应用程序时遇到问题。 (PhoneGap 3.1.0 - on a windows 8 machine) (PhoneGap 3.1.0-在Windows 8计算机上)

I have followed the step so create a windows phone app from the “Windows Phone Command-line Tools”. 我已按照该步骤操作,因此请从“ Windows Phone命令行工具”创建Windows Phone应用程序。 It says to use CordovaWP7xxx.zip + CordovaWP8xxx.zip to create a template and you can create an application from this. 它说使用CordovaWP7xxx.zip + CordovaWP8xxx.zip创建模板,您可以从中创建应用程序。 There is no phonegap download in the latest 3.1.0 version of phone gap. 最新版本的phone gap中没有phonegap下载3.1.0。 I was able to find these templates in the cordova download so I used them instead. 我可以在cordova下载中找到这些模板,因此我改用了它们。

I successfully created and run a project through visual studio using the following command format .\\wp7\\bin\\create PathToNewProject [ PackageName ] [ AppName ] 我使用以下命令格式通过Visual Studio成功创建并运行了一个项目。\\ 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 当我尝试使用phonegap命令时

C:\\Phonegap\\ReflectionPGWP7>phonegap -d local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git C:\\ Phonegap \\ ReflectionPGWP7> phonegap -d本地插件添加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 当我尝试使用cordova命令cordova插件时,请添加org.apache.cordova.device

I get the following error 我收到以下错误

[Error: Current working directory is not a Cordova-based project.] [错误:当前工作目录不是基于Cordova的项目。]

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 ie notifications. 简而言之 :Windows Phone 7带有插件(即通知)是否有电话间隙。 Would love to hear how others got it going Thanks 很想听听别人如何做到这一点,谢谢

So I got it going in the end. 所以我终于做到了。 Must say the documentation regarding this on phonegap was lacking at the time of writing this. 必须说,在撰写本文时缺少关于phonegap的文档。 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. 因此,我安装了github安装程序: http : //windows.github.com/并重新运行了我的插件,它起作用了。 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 您可以从此页面上的“添加功能”部分找到所有插件http://docs.phonegap.com/en/3.0.0rc1/guide_cli_index.md.html#The%20Command%20Interface然后我运行了

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. 因此,我进入了C:\\ Users \\ Controlling change.cordova \\ lib \\ wp \\ cordova \\ 3.1.0上方的目录,并运行createTemplates.bat并重新运行它。 And it compiled it up and ran it in an emulator. 然后将其编译并在模拟器中运行。

All in all it is quite straight forward 总而言之,这很简单

Try creating the project by using the phonegap command: 尝试使用phonegap命令创建项目

phonegap create foldername

Then add the wp8 platform and the plugins you need 然后添加wp8平台所需的插件

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

Then put your own app files in the www folder. 然后将您自己的应用程序文件放在www文件夹中。 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. 要将项目构建为phonegap local build ,这还将把所有更改从www文件夹复制到platforms/wp8/ Visual Studio项目中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM