是否可以在Android中获取蓝牙打印机列表?
如何获取Android中的蓝牙打印机列表?是否可以在Android中获取蓝牙打印机列表?,android,bluetooth,Android,Bluetooth,如何获取Android中的蓝牙打印机列表? 以下代码返回所有蓝牙设备: BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); java.util.Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices(); BluetoothAdapter mBluetoothAdapter=BluetoothAda
以下代码返回所有蓝牙设备:
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
java.util.Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
BluetoothAdapter mBluetoothAdapter=BluetoothAdapter.getDefaultAdapter();
java.util.Set pairedDevices=mBluetoothAdapter.getBondedDevices();
是否可以仅从这些设备中选择打印机
更新:我的打印机蓝牙类的设备类为1664。
但我在Android SDK中找不到这样的常量。
是否所有蓝牙打印机都有1664类设备 这个问题现在已经很老了,但我想向需要这些信息的人分享我自己的经验 您可以在
getBluetoothClass()
上获取次要设备类(getDeviceClass()
)和主要设备类(getMajorDeviceClass()
),并根据可用的类号检查它们1536
是代表成像设备的主要类别,打印机由1664
指定为次要设备类别
您也可以使用此在线设备类计算器生成类:
奇怪的是,它仍然不在Android SDK中。