Bluetooth Discovery on Android

// Expert user has replied.
D Diana Diaconu 3 years 7 months ago
114 2 0

I've been trying the Bluetooth discovery code as suggested in the demo app and also built and tested the provided Zebra Demo app but the Discovery>Bluetooth option never finds anything.
My understanding from the API documentation is that the findPrinters() method in BluetoothDiscoverer will find any discoverable Bluetooth devices, not just printers.
I am using a Moto G Play phone running Android 7.1.1
I have Bluetooth enabled on the phone and if I go to Device Settings>Bluetooth I do see the Bluetooth devices both paired and unpaired.
The Link-OS SDK version is 2.14.5198.
The Zebra printer we are using is a ZQ520. The printer is listed in Settings > Bluetooth on the phone.
The problem is puzzling because the Zebra Setup Utility app is able to discover the printer, but the Zebra Demo app is not (Discovery>Bluetooth).
Is the Zebra Demo app code for Discovery>Bluetooth not up to date or not supposed to work ? Is the documentation at https://techdocs.zebra.com/link-os/2-14/android/content/com/zebra/sdk/pr... incorrect?

Please Register or Login to post a reply

2 Replies

D Diana Diaconu

Unfortunately, that is not the case and there must be some other reason. The app has the permissions but findPrinters() is never returning anything. The phone is paired with a printer and there are also other Bluetooth devices around. Neither printer nor the other devices are found. According to the documentation findPrinters() should detect/find all discoverable devices, not just printers. Maybe I am misunderstanding the documentation? I expected the provided Demo App's BluetoothDiscovery activity to work and discover the paired devices.
If instead of using BluetoothDiscoverer.findPrinters() I use the Android SDK's BluetoothAdapter a call to getBondedDevices() does return all the paired devices.

S Steven Si

This is an issue that developers encounter often when they just start to use Bluetooth on Android. Due to security and privacy, on Android you need to give the permission to the app for using Bluetooth. Please check out this article for details on how-to: Link-OS SDK for Android | Permissions and Bluetooth API.

CONTACT
Can’t find what you’re looking for?