New issue
Advanced search Search tips

Issue 623569 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Jun 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

Warn "'bluetooth' is not allowed for specified platform" on Google Chrome for Linux

Reported by acas...@gmail.com, Jun 27 2016

Issue description

Chrome Version       : Google Chrome	51.0.2704.103 (Official Build) (64-bit)
OS	Linux 
Command Line	/usr/bin/google-chrome-stable --window-depth=24 --flag-switches-begin --enable-web-bluetooth --enable-experimental-extension-apis --flag-switches-end

What steps will reproduce the problem?
(1) Create an extention with bluetooth tag in the manifest.json

(2) At chrome://extensions it will report this warn:
"There were warnings when trying to install this extension:
'bluetooth' is not allowed for specified platform."

(3) Also the example at https://developer.chrome.com/apps/app_bluetooth are outdated or doesn't work for Chrome on Linux (maybe only for Chrome on ChromeOS).

It reports the error:
Uncaught TypeError: Cannot read property 'addListener' of undefined

What is the expected result?

I really was expecting that it works as explained he  because the samples from here https://googlechrome.github.io/samples/web-bluetooth/index.html are working fine!

What happens instead?

Chrome reports that bluetooth is not allowed!

I got it "working" using the Web Bluetooth API:

  navigator.bluetooth.requestDevice({filters: filters})
  .then(device => {
    console.log('> Name:             ' + device.name);
    console.log('> Id:               ' + device.id);
    console.log('> Allowed Services: ' + device.uuids.join('\n' + ' '.repeat(20)));
    console.log('> Connected:        ' + device.gatt.connected);
  })
  .catch(error => {
    console.log('Argh! ' + error);
  });

But I noticed that even if the BLE device is turned off (removing its battery) the log still showing the device:

navigator.bluetooth
Bluetooth
> Name:             Nordic_UART
> Id:               R51ytvmO6IoBRMqaqbLB/w==
> Allowed Services: 
> Connected:        false

I think it is returning the cached result instead of searching for new devices.
 
Labels: OS-Linux

(2) At chrome://extensions it will report this warn:
"There were warnings when trying to install this extension:
'bluetooth' is not allowed for specified platform."

Yeah. the `bluetooth` permission is only for Chrome Apps (not Chrome Extensions) but that will not prevent you to use it for now.
See https://developer.chrome.com/extensions/api_index for no mention of bluetooth while you can find it at https://developer.chrome.com/apps/api_index

---

(3) Also the example at https://developer.chrome.com/apps/app_bluetooth are outdated or doesn't work for Chrome on Linux (maybe only for Chrome on ChromeOS).

As noted in https://developer.chrome.com/apps/bluetooth, the chrome.bluetooth API works only on OS X, Windows and Chrome OS. Not Linux. Hence why you get this error.

---

Regarding the cached issue, it is indeed because Bluez still have it in its cache. It you remove it manually (bluetoothctl / remove 12:34:56:78:90:12), you should not see it anymore. 

The only way to get access to the Chrome Bluetooth API is from a Chrome App where you'll see a Bluetooth Chooser (same as in Web Bluetooth). May I ask why the chrome extension/app environment is needed there?

Comment 2 by acas...@gmail.com, Jun 27 2016

I need to use Chrome Extension because the software I'm developing is a device Configurator that needs to support Serial Port communication and Bluetooth. The Serial is already working.

Comment 3 by ortuno@chromium.org, Jun 27 2016

Does it have to be an extension? Can't it be a chrome app?

Comment 4 by acas...@gmail.com, Jun 27 2016

Yes, it could be a Chrome App, but chrome.bluetooth doesn't work on Linux, from https://developer.chrome.com/apps/bluetooth: "Important: This API works only on OS X, Windows and Chrome OS. "

This Configurator needs to work at least on Linux and Android, Windows and Mac will be extra bonus.

And Web Bluetooth "appears" to work in the Chrome Extension but doesn't show the Bluetooth Chooser. I think the same thing will happen on Chrome App.

Comment 5 by ortuno@chromium.org, Jun 27 2016

Right, chrome.bluetooth doesn't work on all platforms but Web Bluetooth does and it will be available on Chrome Apps starting in m53. You can try it out in Chrome's Dev Channel[1]

https://www.google.com/chrome/browser/desktop/index.html?platform=linux&extra=devchannel

Comment 6 by acas...@gmail.com, Jun 27 2016

Amazing! Thank you very much!
Status: WontFix (was: Unconfirmed)

Sign in to add a comment