Question

I am developing an Android application which would make intense use of Bluetooth RFCOMM connection between two devices, with data streaming using the default BluetoothAdapter.

What I am wondering is:

is it possible to use such a connection while the user is listening to music using a Bluetooth headset?

Était-ce utile?

La solution

When creating a RFCOMM socket to a service record you specify a unique identifier (UUID). These are unique to each connection and you can have multiple open RFCOMM Bluetooth connections to multiple sources/devices with different UUIDs. So yes, you should be able to listen to music while having RFCOMM connections sending/receiving data elsewhere.

See methods listenUsingRfcommWithServiceRecord and createRfcommSocketToServiceRecord on BluetoothAdapter and BluetoothDevice respectively.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top