Discover paired printers

V Vedsatx Saddvv 2 years 11 months ago
6 1 0

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.
 

Please register or login to post a reply

1 Replies

M Matthew Belk

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.

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