1

ACTION_CONNECTION_STATE_CHANGED 是否在 RFCOMM / SPP 连接更改时广播?

还是仅在更改“其他配置文件”(A2DP 等)时广播?

如果 RFCOMM 连接的状态已经由 BluetoothAdapter 管理,我试图避免必须管理它的状态

另外,不是我会求助于它,而是有人尝试在 BluetoothAdapter 中使用@hidden BluetoothStateChangeCallback 接口吗?

4

1 回答 1

3

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?

于 2013-04-15T03:42:32.853 回答