BluetoothGatt Problems

edited May 2019 in Android

So to preface this, I'm fairly certain this is a problem with the android device I am using (it's old - Samsung S4 mini running Android 4.4.2) and we have new devices that have been ordered for our lab so that will likely solve the problem, but for the time being I'm basically just wasting time in the lab trying to get the MMC sensors to connect because I can't really work on anything without this connection.

For a long time my app was working fine (see my previous thread - streaming multiple quaternions simultaneously from MMC sensors to control a leg in Unity 3D) but at some point last week the sensors stopped connecting entirely. After fiddling with the phone all day and resetting it/reinstalling the app and turning bluetooth on and off it randomly just started working again for a few days. Now yesterday the problem popped back up and I can't seem to get it to go away this time.

The logcat info basically just loops this over and over:
01-01 00:13:04.464 10367-12238/com.mbientlab.metawear.tutorial.starter I/BluetoothGatt: Client registered, waiting for callback
01-01 00:13:04.464 10367-12239/com.mbientlab.metawear.tutorial.starter I/MainActivity: Failed to connect 3

with this error code:
E/BluetoothGatt: Bad connection state: 0 failed to register callback

From the debugger:
01-01 00:19:09.323 12802-13011/com.mbientlab.metawear.tutorial.starter D/BluetoothGatt: connect() - device: F6:F6:87:94:33:F3, auto: false
01-01 00:19:09.323 12802-13011/com.mbientlab.metawear.tutorial.starter D/BluetoothGatt: registerApp()
01-01 00:19:09.323 12802-13011/com.mbientlab.metawear.tutorial.starter D/BluetoothGatt: registerApp() - UUID=dc313569-0bcb-462b-8b33-b85358f3bdb6
01-01 00:19:09.373 12802-12814/com.mbientlab.metawear.tutorial.starter D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
01-01 00:19:09.373 12802-13011/com.mbientlab.metawear.tutorial.starter I/BluetoothGatt: Client registered, waiting for callback
01-01 00:19:09.694 12802-12818/com.mbientlab.metawear.tutorial.starter D/BluetoothGatt: refresh() - device: CF:0D:50:10:CC:16
01-01 00:19:09.704 12802-12818/com.mbientlab.metawear.tutorial.starter D/BluetoothGatt: close()
01-01 00:19:09.704 12802-12818/com.mbientlab.metawear.tutorial.starter D/BluetoothGatt: unregisterApp() - mClientIf=6
01-01 00:19:09.724 12802-13012/com.mbientlab.metawear.tutorial.starter I/MainActivity: Failed to connect 2

I'm fairly certain it's the phone itself because even using the nRF Connect app I can't connect to the sensors. It sees them, but just hangs when trying to connect. But my iPhone with the official Metabase app does connect to them still.

I don't expect that there's an obvious solution to this but if you guys have any thoughts while I'm waiting for the new devices I'd love to hear, thanks.


  • Can you use a different Android device?

  • As mentioned, we have new devices on the way to the lab but while they're in transit I can't really work on my project. I'm hoping when they arrive that will just solve the problem but I was hoping for suggestions in the mean time.

  • I'm betting it will. We've seen similar issues from users using old Android devices. A lot of them don't fully support BLE at the hardware or os/firmware/software level.

  • Okay thanks that's good to know. I just find it odd that it worked perfectly for so long and then seemingly randomly stopped working. Maybe this is a silly question but is it possible that I fried the bluetooth hardware in the phone by trying to stream too much information? If so I definitely want to be careful with the new devices but I feel like that shouldn't actually be a problem.

  • No this is not possible. Only the software could have an issue and this would be fixed with a phone shutdown/reboot.

Sign In or Register to comment.