之前我们分析了如何获取已连接的蓝牙设备地址
http://blog.csdn.net/jasonwang18/article/details/61214431
本篇我们分析如何获取对应蓝牙设备的类型,这个类型和profile不是同一个东西,而是具体蓝牙的设备类型,比如手机、电脑、手柄、蓝牙耳机等
我们看到手机搜索到的蓝牙设备类型有三种,手机、电脑和普通蓝牙
/**
* Get the Bluetooth device type of the remote device.
*
* <p>Requires {@link android.Manifest.permission#BLUETOOTH}
*
* @return the device type {@link #DEVICE_TYPE_CLASSIC}, {@link #DEVICE_TYPE_LE}
* {@link #DEVICE_TYPE_DUAL}.
* {@link #DEVICE_TYPE_UNKNOWN} if it's not available
*/
@RequiresPermission(Manifest.permission.BLUETOOTH)
public int getType() {
if (sService == null) {
Log.e(TAG, "BT not enabled. Cannot get Remote Device type");
return DEVICE_TYPE_UNKNOWN;
}
try {
return sService.getRemoteType(this);
} catch (RemoteExceptio