使用Web Bluetooth API时找不到移动设备 [英] Can't find mobile device when using Web Bluetooth API

查看:646
本文介绍了使用Web Bluetooth API时找不到移动设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google开发人员控制台学习Web蓝牙API,但无法找到我的移动设备.还尝试了GitHub上可用的演示
https://github.com/WebBluetoothCG/demos

I am learning Web Bluetooth API, using google dev console, I am unable to find my mobile device. Also tried Demos available on github
https://github.com/WebBluetoothCG/demos

我正在使用chrome(dev),已启用的webbluetooth标志chrome://flags,Ubuntu 16 +,Android BLE 4.1(棉花糖)

I am using chrome (dev),enabled webbluetooth flag 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'}后也尝试过,仍然找不到我的移动设备.任何建议将不胜感激.

Also tried after changing filter to {name: 'Device Name'}, still unable to find my mobile device. Any suggestions will be highly appreciated.

PS:还尝试了BLE外围设备模拟器

PS: Also tried BLE peripheral Simulator

推荐答案

您还尝试了 https://github.com/WebBluetoothCG/web -bluetooth/blob/master/implementation-status.md#chrome

Did you also give a try to https://googlechrome.github.io/samples/web-bluetooth/battery-level.html with the BLE peripheral Simulator? It should work on supported platforms. See 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 )

You mentioned Ubuntu 16+. As you can see in Linux requirements notes (https://github.com/WebBluetoothCG/web-bluetooth/blob/master/implementation-status.md#notes)

Linux:需要安装内核3.19+和BlueZ 5.41+.阅读如何使Chrome Web蓝牙可在Linux上运行.请注意,蓝牙守护程序需要在实验接口上运行:sudo /usr/sbin/bluetoothd -E

Linux: Requires Kernel 3.19+ and BlueZ 5.41+ installed. Read How to get Chrome Web Bluetooth working on Linux. Note that Bluetooth daemon needs to run with experimental interfaces: sudo /usr/sbin/bluetoothd -E

这篇关于使用Web Bluetooth API时找不到移动设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆