Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find mobile device when using Web Bluetooth API

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

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);
    });

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

PS: Also tried BLE peripheral Simulator

like image 706
A.Huzaifa Avatar asked Nov 28 '25 17:11

A.Huzaifa


1 Answers

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

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: 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

like image 85
François Beaufort Avatar answered Nov 30 '25 06:11

François Beaufort



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!