简体   繁体   English

如何获取连接的蓝牙设备类型

[英]How to get the type of the bluetooth device connected

I am getting bluetooth device connected.我正在连接蓝牙设备。 Trying to get the device type.试图获取设备类型。

val pairedDevices: Set<BluetoothDevice> = mBluetoothAdapter.bondedDevices

Check BluetoothClass检查蓝牙类

Represents a Bluetooth class, which describes general characteristics and capabilities of a device.表示蓝牙 class,它描述了设备的一般特性和功能。 For example, a Bluetooth class will specify the general device type such as a phone, a computer, or headset, and whether it's capable of services such as audio or telephony.例如,蓝牙 class 将指定电话、计算机或耳机等一般设备类型,以及它是否能够提供音频或电话等服务。

With getBluetoothClass() you should be able to retrieve this type of informations.使用getBluetoothClass()您应该能够检索此类信息。
Remember the permission in your AndroidManifest.xml记住你的AndroidManifest.xml中的权限

<uses-permission android:name="android.permission.BLUETOOTH" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM