Pair bluetooth device to Android 12 phone by selecting my own pin

47 Views Asked by At

I have modified a Bluetooth device - a number pad - so that it has only a few keys, so when a host asks me to enter a PIN it generates I cannot do that (i.e. I can enter '1111' but not a pin with most numbers). When I pair with Windows, the first try fails, but then the system asks me to choose my own pin, I enter '1111' and the pairing works. On my phone - Android 12 - it insists on using the generated pin and I cannot do that.

I tried pairing programmatically - using Java - I can discover/see the device, initiate the pairing, but it seems the generation of the pin to use is 'encapsulated' (I guess for security reasons) and I cannot bypass that, neither can I choose my own code. I have verified that my code works with an unmodified device where I can enter any numerical pin. Also, I saw a solution that bypasses using a pin, that worked on earlier Android versions, but it is not allowed anymore.

Is there any way I can programmatically choose my own pin to pair a Bluetooth device in Java to a phone running Android 12?

0

There are 0 best solutions below