Android bluetooth事件:240404正在返回怪异的bluetooth deviceClass
我正在使用广播接收器尝试查找蓝牙耳机何时连接/断开与android设备的连接Android bluetooth事件:240404正在返回怪异的bluetooth deviceClass,android,bluetooth,Android,Bluetooth,我正在使用广播接收器尝试查找蓝牙耳机何时连接/断开与android设备的连接 val filter = IntentFilter() filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED) filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED) filter.addAction(BluetoothDevice.ACTI
val filter = IntentFilter()
filter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED)
filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED)
filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED)
我是这样处理这件事的:
device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE)
val major = device?.bluetoothClass?.majorDeviceClass;
val bluetoothClass = device?.bluetoothClass ?: return
我得到的是
为major
(即1024
哪个是正确的)BluetoothClass.Device.major.AUDIO\u VIDEO
asbluetoothClass.deviceClass
but240404
我用错误的属性来比较它吗?我太傻了,我在比较错误的东西。我要比较的是我太傻了,我比较错了。我要比较的是