我正在创建一个应用程序,我想要当我点击扫描按钮时它只扫描BLE而不是Android手机的蓝牙,所以是否有任何权限或依赖关系只扫描BLE不是中心。
答案 0 :(得分:0)
您可以尝试这样做以避免电话:
if (device.getBluetoothClass().getMajorDeviceClass() != BluetoothClass.Device.Major.PHONE) {
// do something
}
请参阅BluetoothClass.Device.Major
并选择您想要的内容
public static class Major {
private static final int BITMASK = 0x1F00;
public static final int MISC = 0x0000;
public static final int COMPUTER = 0x0100;
public static final int PHONE = 0x0200;
public static final int NETWORKING = 0x0300;
public static final int AUDIO_VIDEO = 0x0400;
public static final int PERIPHERAL = 0x0500;
public static final int IMAGING = 0x0600;
public static final int WEARABLE = 0x0700;
public static final int TOY = 0x0800;
public static final int HEALTH = 0x0900;
public static final int UNCATEGORIZED = 0x1F00;
}