Reputation: 453
I've created an app where I'm printing some text data from app to BlueTooth Printer. App is working fine but only one thing is there that I've given harcoded name of the BlueTooth Printer to print the data.
I want to make my app to send text data to any android compatible Bluetooth printer. Any help or small hint will be helpful.
Is there some property of BluetoothDevice which can be helpful in finding out whether the connected Device is a Bluetooth Printer or not? Thanks in Advance!
Upvotes: 1
Views: 909
Reputation: 458
If you use the BluetoothDevice class, you can call the getBluetoothClass()
function. This returns a BluetoothClass object, and on that you can use getMajorDeviceClass()
to get the major device class and getDeviceClass()
to get the minor device class. I believe printers should have 1536 as their major class and 1664 as their minor device class. You might want to oduble check those device classnumbers, though.
Upvotes: 1