5

I want to initiate a pairing request (not connection at this point of time) to a non android device. This can be found working on Settings Application > Network > Bluetooth Settings > Click on a device after scan. A pop up appears on both the devices with a 6 digit pin.

As per Android's documentation this should have popped up in my application as well, if I do something like this

device.createRfcommSocketToServiceRecord(MY_UUID);

As per Android's API documentation

"Once a connection is made with a remote device for the first time, a pairing request is automatically presented to the user."

And it is also mentioned that

"The current Android Bluetooth API's require devices to be paired before an RFCOMM connection can be established. (Pairing is automatically performed when you initiate an encrypted connection with the Bluetooth APIs.)"

Even when I used the sample Bluetooth Chat application (only to test if it initiates a pairing on first connection) it didn't worked.

I also tried using a generic UDID like "00001101-0000-1000-8000-00805F9B34FB" but to no avail.

Couldn't find the source code of Settings Application (Android OS 2.1) to figure out myself. The sources available in Android GIT were for Android 2.3

Even if you cannot answer the question, only pointing out to Android Packages Settings App sources for Android 2.1 might do the trick for me.

Rahul Choudhary
  • 3,789
  • 2
  • 30
  • 30

1 Answers1

4

It works for me with this UUID : "00001101-0000-1000-8000-00805F9B34FB". The intent for pairing request is launched when you call socket.connect() if I remember correctly.

roly
  • 220
  • 2
  • 5
  • It worked for me finally when I deleted the app and removed pairing from both devices (which I manually created earlier). Didn't knew what was faulty, may be I was trying too many things to make it work. – Rahul Choudhary Apr 25 '11 at 16:42
  • 2
    @roly Just out of curiosity: Where is that UUID coming from? – AgentKnopf Feb 17 '12 at 14:30
  • 4
    @Zainodis It's quoted on d.android.com here: [link](http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#createInsecureRfcommSocketToServiceRecord(java.util.UUID))(As hint) – roly Jun 20 '12 at 13:36