Also, If I get a notification, is there a way to click it programmatically and bring the pairing request to to front?
for reference to explain why and what, please have a look here: Bluetooth pairing request on notification bar?
The solution is quite easy if you know it and if it fits into your application:
private void feintBluetoothDeviceDiscovery() {
BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
btAdapter.startDiscovery();
btAdapter.cancelDiscovery();
}
Call feintBluetoothDeviceDiscovery()
before you try to pair or connect your bluetooth device. The popup should appear in the front.
We also had this issue in our automated tests. A pairing request only showing as notifications are a pain there. Thank to a colleague for sharing the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With