Is ACTION_CONNECTION_STATE_CHANGED broadcasted on changes to RFCOMM / SPP connections?

Or is it only broadcast on changes to the 'other profiles' (A2DP etc.)

I'm trying to avoid having to manage the state of an RFCOMM connection if it's state is already being managed by the BluetoothAdapter

Also, not that I would resort to it but, has anyone attempted to use the @hidden BluetoothStateChangeCallback interface in BluetoothAdapter?

有帮助吗?

解决方案

RFCOMM is not a bluetooth 'Profile' it is a protocol.

Serial Port Profile (SPP) is based on RFCOMM and is a profile. Though I am using

"the well-known SPP UUID 00001101-0000-1000-8000-00805F9B34FB"

SPP doesn't seem to be an 'officially supported' profile, and thus ACTION_CONNECTION_STATE_CHANGED is not broadcast.

ACTION_ACL_CONNECTED, ACTION_ACL_DISCONNECTED, and ACTION_ACL_DISCONNECT_REQUESTED broadcast events of BluetoothDevice can be used to listen for the state of a bluetoothDevice.

These are low level events that will be broadcast for both the RFCOMM protocol and Profile connections.

I've found that these broadcasts don't necessarily behave in an expected manner though. As was also experienced here What triggers the BluetoothDevice.ACTION_ACL broadcasts?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top