1
我想制作一个蓝牙广播接收器,它只对连接到蓝牙免提车载套件有反应。但我不知道如何过滤掉它。蓝牙广播接收器,如何获得BleutoothClass
有没有什么办法可以获得BluetoothClass.Device出于意图,还是另一种获得它的方式?
我从下面的东西开始,但我没有找到正确的方法。 一此外,以下如果块当您从设备断开被称为(仅适用没有这个final int state = intent.getIntExtra(???);
if (action.equals("android.bluetooth.device.action.ACL_CONNECTED")) {
final int state = intent.getIntExtra(???);
}
希望你能帮助我,坦克给大家。
SOLUTION:
BluetoothDevice device = (BluetoothDevice) intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
int btClass = device.getBluetoothClass().getDeviceClass();
if (btClass == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE|| btClass == BluetoothClass.Device.AUDIO_VIDEO_CAR_AUDIO){...}
谢谢,但那不是我所搜索的。 – MEX