Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically connect to a Bluetooth headset from an Android application

I am looking for a way to initiate the audio connection between the Android phone and my headset within my application. The idea is to simplify the connection process in such a way that the user doesn't have to go through the different settings menus anymore (Apps -> Settings -> Wireless & Networs -> Bluetooth settings).

Both devices are supposed to be already paired and the Bluetooth address of the headset to be known.

As far as I learned, the Bluetooth capabilities (available since version 2.0 of the Android SDK) are restricted to Bluetooth discovery and the connection of RFComm channels (host/client) between the Android phone and a Bluetooth device. Is there another way to request Bluetooth profiles on the Android system to initiate a connection to a known device from an app or is this impossible?

like image 538
Jiri Holzbecher Avatar asked Feb 04 '10 21:02

Jiri Holzbecher


1 Answers

Have you looked at the BluetoothAdapter class? It seems like you can do everything you need via that class, unless I misunderstand the question.

As for initiating a connection to a specific device, won't the phone auto-pair with the known device once you enable bluetooth?

like image 71
Mark B Avatar answered Oct 06 '22 00:10

Mark B