Android Bluetooth - How to initiate pairing

I want to initiate a connection request (not a connection at a given time) to a non-Android device. This can be found in Settings> Network> Bluetooth Settings> Click on the device after scanning. A popup window appears on both devices with a 6-digit output.

According to the documentation on Android, this was supposed to appear in my application as well, if I do something like this

device.createRfcommSocketToServiceRecord(MY_UUID);

According to Android API documentation

"As soon as the connection is made using the remote device for the first time, the pairing request is automatically presented to the user."

And it is also mentioned that

"The current Android Bluetooth APIs require devices to pair up before the RFCOMM connection can be established. (Pairing is done automatically when you start an encrypted connection with the Bluetooth API.)"

Even when I used the sample bluetooth chat application (only to check if it initiates a connection on the first connection), it did not work.

I also tried using a common UDID, for example, "00001101-0000-1000-8000-00805F9B34FB", but to no avail.

Could not find the source code for the Settings app (Android OS 2.1) to find out for myself. Sources available in Android GIT were for Android 2.3

Even if you can’t answer the question just by pointing to the Android Packages Settings for Android 2.1, you can do the trick for me.

+5
1

UUID: "00001101-0000-1000-8000-00805F9B34FB". socket.connect(), .

+3

All Articles