简体   繁体   中英

Use Phonegap/Cordova plugin in Windows Store JS/HTML/CSS app?

I doing a port of my Phonegap game to Windows Store. I have created a javascript project for the purpose. 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...

For example I need "device.uuid" which is found in the Device-plugin.

Does anyone know how to use a Phonegap plugin when developing a javascript Windows Store app powered by Phonegap?

From the PhoneGap documentation found at http://docs.phonegap.com/en/3.3.0/cordova_device_device.md.html#device.uuid

Windows Phone 7 and 8 Quirks

The uuid for Windows Phone 7 requires the permission ID_CAP_IDENTITY_DEVICE. Microsoft will likely deprecate this property soon. 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.

Per the documentation, as well as Apple's stance on not using uuid anymore, I would recommend against using it. 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. 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. Use the CLI's plugin command, described in The Command-Line Interface, to add or remove this feature for a project:

 $ 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.

After doing so, the next time you issue a phonegap build <platform> , it will merge in the settings and copy the appropriate plugin files.

EDIT: Windows Store (Windows 8) is different than the approach for Windows Phone 7/8. For that platform, see the platform guide about using Visual Studio (express edition will work) by going here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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