2015/07/18 に試すと、requestDevice() は引数を1つ要求してくるように変化している。また、permission を要求してくる。
permission API は Chrome 43 から追加されているが、bluetooth 関連の ID はまだ利用できないようだ。
- Permissions API https://w3c.github.io/permissions/#h-midi
- WebBluetoothCG/chrome-app-polyfill https://github.com/WebBluetoothCG/chrome-app-polyfill
- 情報源
var opt = { filters: [ { services: ['generic_access'] } ] };
navigator.bluetooth.requestDevice(opt).then(
function(d) { console.log("found a device", d); },
function(e) { console.error(e); }
);
DOMException: Must be handling a user gesture to show a permission request.(anonymous function)navigator.permissions.query({name:'bluetooth'})
Uncaught (in promise) TypeError: The provided value 'bluetooth' is not a valid enum value of type PermissionName.