Android - RFCOMM socket without any input from user

Here s the scenario.

I need to write an application for android to create a RFCOMM socket to a pc with a BT dongle (I'm going to write the server too).

My requirement is that the user doesn't have to pair device manually.

Actually, with a big hack, I'm using the createInsecureRfcommSocket.

A little scenario: I've an android application which exchanges information with a linux box with rfcomm socket opened. I can manually set the PIN on the devices (hardcoding it IS an option)

I'm looking for different roads:

Write a JNI wrapper

As has been done here by Max Kellermann, I can write a jni layer to make all the pairing phase. This should be a good options, but there's a problem:

The NDK 4b does not provide libbluetooth libraries, so -lbluetooth fails, as well as the NDK v.3.

Options:
Find the NDK 1.5 (which includes lib bluetooth). After days of web search I've been not able to find out. Anyone has or knows where I can find it?
Compile libbluetooth for android by myself and use them for -lbluetooth. No lucky there, I'm not able to build them. Any hint?

Use something exposed by the APIs

Any one know how can I use createRfcommSocketToServiceRecord and have the user not to manually pair the device? Is it possible? How should I write the server?

Something I do not know

Maybe (sure!) there is something I do not know. Maybe I can use something else? Not RFCOMM? SDP?

Maybe I can manyally pair with android api?

I hope to have been clear enough, if not just ask. And again, as it's not the first time, I'm in your hands :)

VIEW COMPLETE THREAD WITH REPLIES

Popular Posts