Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 491
Volodymyr Bezuglyy Avatar asked Apr 24 '14 15:04

Volodymyr Bezuglyy


People also ask

How do I get a list of Bluetooth devices?

Swipe down from the top of the screen. Touch and hold Bluetooth . If your accessory is listed under "Available media devices," next to your device's name, tap Settings . If no accessories are listed under "Previously connected devices," tap See all.

How do I get a list of Bluetooth devices on my Android phone?

By using BluetoothAdapter method getBondedDevices(), we can get the Bluetooth paired devices list. Following is the code snippet to get all paired devices with name and MAC address of each device.

Why cant my phone find my Bluetooth printer?

Make sure the mobile device's Bluetooth is turned on. Check to see if the printer's Bluetooth light is pulsing. If not, enable Bluetooth on the printer and try pairing with the printer again. Check if the printer is communicating with another mobile device.


1 Answers

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

like image 149
Alireza Avatar answered Sep 17 '22 16:09

Alireza