如何运行科尔多瓦
问题描述:
科尔多瓦 - 插件 - 铬 - 应用程序 - 蓝牙我有插件科尔多瓦 - 插件 - 铬 - 应用蓝牙和科尔多瓦 - 插件 - 铬 - 应用程序 - 共同如何运行科尔多瓦
一个科尔多瓦应用cordova plugin add cordova-plugin-chrome-apps-bluetooth
cordova plugin add cordova-plugin-chrome-apps-common
我想读chrome.bluetooth.getAdapterState()
app.scan = function() {
console.log("app.scan()");
var res = chrome.bluetooth.getAdapterState(function( adapterInfo) {
console.log("callback");
console.log("adapterInfo");
}
);
};
index.html中
结果:
<button on-click="app.scan()" >scan</button>
在铬JS控制台,我可以看到app.scan(),但回调一直没有出现。
是这个插件应该在科尔多瓦真的有用吗?或者可能是我错过了什么?
答
尝试安装插件 “科尔多瓦 - 插件,Android的支持-V4”,它为我工作。正在讨论这个线程:https://github.com/MobileChromeApps/cordova-plugin-chrome-apps-bluetooth/issues/3#issuecomment-144164329
由于内容安全政策的Chrome应用程序,内联JS脚本不允许在这里:https://developer.chrome.com/apps/contentSecurityPolicy – gui47