[英]Use Phonegap/Cordova plugin in Windows Store JS/HTML/CSS app?
I doing a port of my Phonegap game to Windows Store. 我正在将Phonegap游戏的端口移植到Windows应用商店。 I have created a javascript project for the purpose. 我已经为此目的创建了一个javascript项目。 I have no problems connecting to the basic phonegap distribution (phonegap.js) but when I comes to phonegap plugins I have no idea how to add them to my solution... 连接基本的phonegap发行版(phonegap.js)时我没有任何问题,但是当我谈到phonegap插件时,我不知道如何将它们添加到解决方案中...
For example I need "device.uuid" which is found in the Device-plugin. 例如,我需要在设备插件中找到的“ device.uuid”。
Does anyone know how to use a Phonegap plugin when developing a javascript Windows Store app powered by Phonegap? 在开发由Phonegap支持的javascript Windows Store应用程序时,有人知道如何使用Phonegap插件吗?
From the PhoneGap documentation found at http://docs.phonegap.com/en/3.3.0/cordova_device_device.md.html#device.uuid 从位于http://docs.phonegap.com/zh/3.3.0/cordova_device_device.md.html#device.uuid的PhoneGap文档中
Windows Phone 7 and 8 Quirks Windows Phone 7和8怪癖
The uuid for Windows Phone 7 requires the permission ID_CAP_IDENTITY_DEVICE. Windows Phone 7的uuid需要权限ID_CAP_IDENTITY_DEVICE。 Microsoft will likely deprecate this property soon. Microsoft可能会很快弃用此属性。 If the capability is not available, the application generates a persistent guid that is maintained for the duration of the application's installation on the device. 如果该功能不可用,则该应用程序会生成一个持久性Guid,该GUID在应用程序在设备上的安装期间将得到维护。
Per the documentation, as well as Apple's stance on not using uuid anymore, I would recommend against using it. 根据文档以及苹果关于不再使用uuid的立场,我建议您不要使用它。 I know that stinks because it is a nice mechanism for activating/tracking devices and licensing for enterprise apps (what I was using it for). 我知道这很臭,因为它是激活/跟踪设备以及为企业应用程序授予许可的一种很好的机制(我当时使用了它)。 But, there are other good mechanisms for doing this if you search a bit. 但是,如果您稍作搜索,还有其他好的机制可以执行此操作。
Aside from that, your question is really about how to get the DEVICE plugin going. 除此之外,您的问题实际上是关于如何启动DEVICE插件的。 I would again refer back to the above link (just scroll to the top) and note: 我将再次参考上面的链接(只需滚动到顶部)并注意:
Accessing the Feature 访问功能
As of version 3.0, Cordova implements device-level APIs as plugins. 从3.0版开始,Cordova将设备级API实施为插件。 Use the CLI's plugin command, described in The Command-Line Interface, to add or remove this feature for a project: 使用命令行界面中介绍的CLI的plugin命令,为项目添加或删除此功能:
$ cordova plugin add org.apache.cordova.device
That command should be ran from the commandline and while in the directory/folder of your application (that you are building). 该命令应从命令行运行,并且应在您正在构建的应用程序的目录/文件夹中运行。 This causes the config.xml to be updated and the system to download the necessary files to support this functionality on various platforms. 这将导致config.xml被更新,并且系统将下载必要的文件以支持各种平台上的此功能。
After doing so, the next time you issue a phonegap build <platform>
, it will merge in the settings and copy the appropriate plugin files. 这样做之后,下一次您发布phonegap build <platform>
,它将合并到设置中并复制适当的插件文件。
EDIT: Windows Store (Windows 8) is different than the approach for Windows Phone 7/8. 编辑: Windows应用商店(Windows 8)与Windows Phone 7/8的方法不同。 For that platform, see the platform guide about using Visual Studio (express edition will work) by going here . 对于该平台,请转到此处,有关使用Visual Studio的平台指南(快速版将可用)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.