Reputation: 141
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
Upvotes: 3
Views: 3314
Reputation: 5659
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
Upvotes: 2