我正在尝试将此插件添加到 PhoneGap 应用程序。
我使用了这个命令:
$ cordova plugin add cordova-media-with-compression
我可以看到插件正确添加到运行此插件的列表中:
$ phonegap plugin list
但是当我使用PhoneGap Developer App(在 iPhone 上)时,插件不可用。
我正在运行此代码以在运行时获取已安装插件的列表:
document.addEventListener("deviceready", function () {
var pluginList = cordova.require("cordova/plugin_list").metadata;
console.log(JSON.stringify(pluginList));
});
如果我从浏览器或 PhoneGap Developer App 运行应用程序,上面的代码会返回两组不同的插件。从浏览器我得到这个:
{
"cordova-media-with-compression": "2.1.0",
"cordova-plugin-battery-status": "1.1.2",
"cordova-plugin-camera": "2.1.1",
"cordova-plugin-compat": "1.1.0",
"cordova-plugin-console": "1.0.4",
"cordova-plugin-contacts": "2.0.1",
"cordova-plugin-device": "1.1.3",
"cordova-plugin-device-motion": "1.2.2",
"cordova-plugin-device-orientation": "1.0.4",
"cordova-plugin-dialogs": "1.2.1",
"cordova-plugin-file": "4.3.0",
"cordova-plugin-file-transfer": "1.5.1",
"cordova-plugin-geolocation": "2.1.0",
"cordova-plugin-globalization": "1.0.4",
"cordova-plugin-inappbrowser": "1.3.0",
"cordova-plugin-network-information": "1.2.1",
"cordova-plugin-splashscreen": "3.2.2",
"cordova-plugin-statusbar": "2.1.3",
"cordova-plugin-vibration": "2.1.2",
"cordova-plugin-whitelist": "1.2.2"
}
从PhoneGap Developer App我得到这个:
{
"com.wikitude.phonegap.WikitudePlugin": "5.3.0",
"cordova-plugin-battery-status": "1.2.0",
"cordova-plugin-ble-central": "1.1.2",
"cordova-plugin-camera": "2.3.0",
"cordova-plugin-compat": "1.0.0",
"cordova-plugin-console": "1.0.4",
"cordova-plugin-contacts": "2.2.0",
"cordova-plugin-device": "1.1.3",
"cordova-plugin-device-motion": "1.2.2",
"cordova-plugin-device-orientation": "1.0.4",
"cordova-plugin-dialogs": "1.3.0",
"cordova-plugin-file": "4.3.0",
"cordova-plugin-file-transfer": "1.6.0",
"cordova-plugin-geolocation": "2.4.1-dev",
"cordova-plugin-globalization": "1.0.4",
"cordova-plugin-inappbrowser": "1.5.0",
"cordova-plugin-insomnia": "4.2.0",
"cordova-plugin-media": "2.4.0",
"cordova-plugin-media-capture": "1.4.0",
"cordova-plugin-network-information": "1.3.0",
"cordova-plugin-splashscreen": "4.0.0",
"cordova-plugin-statusbar": "2.2.0",
"cordova-plugin-whitelist": "1.3.0",
"cordova-plugin-x-socialsharing": "5.1.3",
"phonegap-plugin-barcodescanner": "6.0.3",
"phonegap-plugin-contentsync": "1.2.5",
"phonegap-plugin-mobile-accessibility": "1.0.4",
"phonegap-plugin-push": "1.8.3"
}
如您所见,在第一个列表中有插件cordova-media-with-compression
,而在第二个列表中没有。
为什么两个插件列表不相等?我怎样才能在PhoneGap 开发者应用程序中获得新安装的插件?