5

实验性的Web 蓝牙 API在Android Marshmallow的开发版Chrome 中运行良好。我可以简单地启用实验标志,chrome://flags/#enable-web-bluetooth我很高兴。

遗憾的是,Web 蓝牙 API 在我的 Android Lollipop 设备上不起作用。为什么?

4

1 回答 1

14

更新:截至 2017 年 4 月 17 日,Android 上的网络蓝牙现在需要 Android Marshmallow:http ://crbug.com/694332

首先,感谢您的提问。你肯定不是唯一一个……

https://github.com/WebBluetoothCG/web-bluetooth/blob/gh-pages/implementation-status.md#notes中所述,

为了方便开发人员,Chromium 构建可在 Android Lollipop 或更高版本上运行 - 但 Chrome 版本将仅支持 Marshmallow 或更高版本。

因此,以下是如何在 Chrome for Android Lollipop 上使用 Web 蓝牙:

  1. 打开安卓设置应用
  2. 确保“开发者选项”已解锁且可用 -帮助
  3. 选择“开发人员”并启用“USB调试”
  4. 将您的 Android 设备插入计算机
  5. 在您的 Android 设备上接受“USB 调试”会话
  6. 在您的计算机上通过https://download-chromium.appspot.com/?platform=Android下载适用于 Android 的最新 Chromium 版本
  7. 例如chrome-android.zip,在您的文件夹中提取下载的文件~/Downloads
  8. 如果尚未安装ADB ,请在您的计算机上安装
  9. adb install -r ~/Downloads/chrome-android/apks/ChromePublic.apk通过输入你的 shell来安装 Chromium
  10. 在您的 Android 设备上打开新的 Chromium 应用程序
  11. 例如,通过转到https://www.google.com接受 Chromium 位置提示- 需要位置权限才能在 Chrome for Android Lollipop 中访问蓝牙。
  12. 最后在chrome://flags/#enable-web-bluetooth和/或请求原始试用令牌处启用实验标志,以便您的网站可以在没有任何标志的情况下使用 Web 蓝牙 API。
  13. 在https://googlechrome.github.io/samples/web-bluetooth/上玩一些网络蓝牙示例

笔记:

警告!适用于 Android 的 Chromium 版本不会像 Google Chrome 那样自动更新。如果您想要新版本的 Chromium 来测试新功能,则必须重新下载并在您的 Android 设备上重新安装它。

于 2016-01-15T11:36:20.453 回答