2

I have an application which connects to a BLE device from various Android devices. The following are working fine: All Samsung phones, OnePlus, LG v40, Redmi Note 8. But Redmi9 and Lenovo TB-8505F do not get connected.

Scanning works and I see my device advertising. But when I call: BluetoothDevice's connectGatt() method I never receive the onConnectionStateChange() callback I usually get. I've tried various connectGatt() parameters but none of them work.

As far as my BLE device is concerned, it is connected just fine. But the Android's OS never sends the callback. Another strange thing is: If I shut down the BLE device, then onConnectionStateChange() gets called with the infamous 133 status.

The following permissions are specified in my manifest file:

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
  • Check the logcat log, hci snoop log or use an air sniffer to try to understand where it stops working. – Emil Aug 30 '21 at 07:40
  • Can you connect fine using nRF Connect app? Have a look at this answer as it may have relevant suggestions: https://stackoverflow.com/questions/65629978/ble-gatt-getting-disconnected-sometimes-after-connection-with-exception-gattcal/65662801#65662801 – Youssif Saeed Aug 30 '21 at 07:41
  • Thanks for the tip. Tried connecting with nRF Connect but the same happens. logcat doesn't help either. I'll try hci snoop next. – Danny Milman Aug 31 '21 at 06:27

0 Answers0