我目前正在开发一个应用程序,我需要扫描通过Bluetooth classic安装了我的应用程序的移动设备。我知道蓝牙LE的扫描方法接受 APPLICATION_UUID 。 如果有人知道BT Classic的方法请分享, 提前谢谢。
答案 0 :(得分:0)
似乎BT Classic没有这样的方法,但你可以过滤"扫描"设备Device Class:
BroadcastReceiver mReceiver = new BroadcastReceiver(){
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(action.equals(BluetoothDevice.ACTION_FOUND)){
BluetoothDevice btDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
if(btDevice .getBluetoothClass().getDeviceClass() == BluetoothClass.Device.<your_class>) {
// do your magic with filtered device
}
}
您还可以检查多个设备类:
int deviceClass = btDevice .getBluetoothClass().getDeviceClass()
if (deviceClass == Device.AUDIO_VIDEO_WEARABLE_HEADSET
|| deviceClass == Device.AUDIO_VIDEO_CAR_AUDIO
|| deviceClass == Device.AUDIO_VIDEO_HANDSFREE
and so on.