'Unable to Connect to BLE device in Android 12+

I am trying to connect to BLE device in Android 12 using connectGatt method but It's not connecting.

Below Android 11 it is working fine.

  1. I have added all the required permissions for Android 12 Manifest.permission.BLUETOOTH_SCAN and Manifest.permission.BLUETOOTH_CONNECT.
  2. I have tried all the transports AUTO, BLE and BR/EDR.
  3. I am also allowing runtime permissions for Bluetooth.

The required device MAC address is found in discover callback. But, When I try to connect It's not receiving any callback and after few seconds It's sending me DISCONNECT BroadcastReceiver.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source