我正在学习 Web 蓝牙 API,使用 google 开发控制台,我无法找到我的移动设备。还尝试了 github 上提供的演示
https://github.com/WebBluetoothCG/demos https://github.com/WebBluetoothCG/demos
我正在使用 chrome (dev),启用了 webbluetooth 标志 chrome://flags、Ubuntu 16+、Android BLE 4.1 (Marshmallow)
navigator.bluetooth.requestDevice({
filters: [{
services: ['battery_service']
}]
}).then(device => {
console.log('Got device:', device.name);
console.log('id:', device.id);
});
将过滤器更改为后也尝试过{name: 'Device Name'}
,仍然无法找到我的移动设备。任何建议都将受到高度赞赏。
PS:还尝试过 BLE 外设模拟器
你是否也尝试过https://googlechrome.github.io/samples/web-bluetooth/battery-level.html https://googlechrome.github.io/samples/web-bluetooth/battery-level.html使用 BLE 外设模拟器?它应该可以在支持的平台上运行。看https://github.com/WebBluetoothCG/web-bluetooth/blob/master/implementation-status.md#chrome https://github.com/WebBluetoothCG/web-bluetooth/blob/master/implementation-status.md#chrome
您提到了 Ubuntu 16+。正如您在 Linux 需求说明中所看到的(https://github.com/WebBluetoothCG/web-bluetooth/blob/master/implementation-status.md#notes https://github.com/WebBluetoothCG/web-bluetooth/blob/master/implementation-status.md#notes)
Linux:需要安装内核 3.19+ 和 BlueZ 5.41+。读如何让 Chrome 网络蓝牙在 Linux 上运行 https://acassis.wordpress.com/2016/06/28/how-to-get-chrome-web-bluetooth-working-on-linux/。请注意,蓝牙守护程序需要使用实验接口运行:sudo /usr/sbin/bluetoothd -E
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)