I'm following the ZSDK_DemosAndroid project to discover bluetooth paired Zebra Printer's so as to get their mac address.My code for this runs on my main Activity and is like this,
new Thread(() -> {
Looper.prepare();
try {
BluetoothDiscoverer.findPrinters(this, new DiscoveryHandler() {
@Override public void foundPrinter(DiscoveredPrinter discoveredPrinter) { runOnUiThread(() -> System.out.println("FOUND PRINTER " + discoveredPrinter));}
@Override public void discoveryFinished() {runOnUiThread(() -> System.out.println("FINISHED DISCOVER"));}
@Override public void discoveryError(String s) {}
});
} catch (ConnectionException e) {e.printStackTrace();} finally {Looper.myLooper().quit();}
}).start();
Although i do have a paired printer, foundPrinter() never runs but discoveryFinished() does.Thus i don't get the connected Printer.Could this be permission-related?I've already set the following permissions in my manifest though.
1 Replies
I have a similar behavior. The BluetoothDiscoverer will return a list of discoverable, unpaired printers, but it will not return printers that have already been paired. Very frustrating.