简体   繁体   中英

Is it possible to get list of Bluetooth printers in Android?

How to get list of Bluetooth printers in Android?
Following code returns all bluetooth devices:

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
java.util.Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();

Is it possible to select only printers from these devices?

UPDATE:
Device class of bluetooth class of my printer is 1664.
But I cannot find such constant in Android SDK.
Do all bluetooth printers have device class 1664?

This question is rather old now, but I would like to share my own experience for anyone needing this information.

You can get minor device class ( getDeviceClass() ) and major ( getMajorDeviceClass() ) on getBluetoothClass() and check them against available class numbers. 1536 is a major class representing imaging devices, and printers are specified by 1664 as the minor device class.

You may also use this online device class calculator to generate the classes:

http://bluetooth-pentest.narod.ru/software/bluetooth_class_of_device-service_generator.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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