2

I am trying to increase the timeout of the bluetooth pairing window (currently the window stays for only few seconds). Is there any way to achieve this action ?

pairing window screenshot

I have already tried methods from these stackoverflow links :

How to pair Bluetooth device programmatically Android

How to programmatically pair a bluetooth device on Android

Android bluetooth, override pairing prompts

None of the above links have the answer what i am looking for, is there anybody to help me to solve this problem ? is there any method to increase the time-out of the bluetooth pairing screen

Community
  • 1
  • 1
Safvan 7
  • 395
  • 3
  • 12

1 Answers1

3

Ty this, the Pairing window will never timeout

public void pairDevice(final BluetoothDevice device) {

             String ACTION_PAIRING_REQUEST = "android.bluetooth.device.action.PAIRING_REQUEST";
             Intent intent = new Intent(ACTION_PAIRING_REQUEST);
             String EXTRA_DEVICE = "android.bluetooth.device.extra.DEVICE";
             intent.putExtra(EXTRA_DEVICE, device);
             String EXTRA_PAIRING_VARIANT = "android.bluetooth.device.extra.PAIRING_VARIANT";
             int PAIRING_VARIANT_PIN = 0;
             intent.putExtra(EXTRA_PAIRING_VARIANT, PAIRING_VARIANT_PIN);
             intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
             startActivity(intent);
}
J.R
  • 2,113
  • 19
  • 21