蓝牙在 Raspberry Pi 的 Android 中不起作用

Bluetooth not working in Android things for Rasberry Pi

当我尝试启用 BluetoothAdapter 时出现以下错误。

 08-30 11:53:34.310 1492-1492/com.example.androidthings.gattserver D/GattServerActivity: Bluetooth is currently disabled...enabling 
 08-30 11:53:34.314 1492-1492/com.example.androidthings.gattserver D/GattServerActivity: Bluetooth is currently disabled...enabling 
 08-30 11:53:34.585 1492-1492/com.example.androidthings.gattserver D/vndksupport: Loading /vendor/lib/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace. 
 08-30 11:53:34.787 1492-1505/com.example.androidthings.gattserver D/BluetoothAdapter: onBluetoothServiceUp: android.bluetooth.IBluetooth$Stub$Proxy@c8a1daa
 08-30 11:53:46.854 1492-1506/com.example.androidthings.gattserver D/BluetoothAdapter: onBluetoothServiceDown: android.bluetooth.IBluetooth$Stub$Proxy@c8a1daa

有人可以帮助我理解并修复这个错误吗?

在 Android 事物中启用蓝牙时,以编程方式执行:

adapter.enable()

REQUEST_ENABLE_INTENT 可能无法正常工作,因为您的 Raspberry 可能未连接到屏幕并且不会显示权限对话框。请记住,您还需要 BLUETOOTH_ADMIN 权限。