I am seeing the Android bluetooth disconnection often when I am trying to interact with a hardware using my android app. I am nto sure if it is due to my Android App/firmware or due to some other Android API issue.What logs I can enable to check the reason for the disconnection - time out, etc or other disconnection reason.I remember there is some disconnection reason we can get. Will that be ok to debug this intermittent discussion. Please assist !
2 Answers
See this google's sample project on Bluetooth. It isn't ble though. https://github.com/googlesamples/android-BluetoothChat . The point is, that there is a separate thread, listening for changes in device state - when it connected, connection is lost. You can log state events from there.

- 3,217
- 2
- 13
- 11
you can enable snoop logs from developer options in Android Phone. and once recorded the logs can be viewed using wire shark. this gives you HCI to above layer view of the bluetooth packet exchange. this also includes a Disconnect complete event ( with the reason for disconnection). if the disconnection reason is not clear enough at this level then the most reliable way is to collect an airtrace using bluetooth sniffer (Ellisys, FrontLine etc), this gives accurate set of control packet exchange which resulted in a disconnection ( analyzing this requires a familiarity with bluetooth protocol). I believe you have already tried enabling bluedroid logs to see what is happening at the profile level.

- 1,134
- 9
- 20
-
bluedroid logs?Not yet.But yes I have gathered the snoop logs .Are the bluedroid logs same as snoop logs? – Raulp May 23 '17 at 08:27
-
The bluedroid logs are bluetooth host stack logs , these contain information about what is happening in the bluedroid host stack. they are different from the snoop logs – bare_metal Jun 07 '17 at 14:18
-
How can I enable them in a production phone? – Raulp Jun 07 '17 at 17:54