0

When I try to enable BluetoothAdapter I get the following error.

 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

Can someone help me to understand and fix this error?

Alessio
  • 3,404
  • 19
  • 35
  • 48
  • 1
    Please add the relevant code to your question. How do you initialize the Bluetooth adapter and what you do when it's enabled? Also specify what version of Android Things are you using on your RaspBerry Pi. – Roberto Betancourt Aug 30 '18 at 14:55
  • `code` mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (!mBluetoothAdapter.isEnabled()) { Intent enableBT = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBT, 1); } mBluetoothAdapter.enable(); `code` I am trying to enable Bluetooth and connect to HC-05 which is connected to Arduino. But as this error occurs I am not even able to discover my PI using my phones Bluetooth – Akash Salow Aug 30 '18 at 16:18

1 Answers1

1

When enabling Bluetooth in Android Things, do it programatically with:

adapter.enable()

The REQUEST_ENABLE_INTENT may not work since your Raspberry might not be connected to a screen and won't show the permission dialog. Remember that you will also need the BLUETOOTH_ADMIN permission.

Roberto Betancourt
  • 2,375
  • 3
  • 27
  • 35
  • The enable() function also returns the same error. So I decided to test with Raspbian OS it showed some error in the boot screen [FAILED] Failed to start Configure Bluetooth Modems Connected by UART – Akash Salow Aug 31 '18 at 09:49
  • It was due to some hardware issues in my old pi. I bought a new one it works fine :) thanks for the help. – Akash Salow Oct 05 '18 at 10:41