0 Replies Latest reply on Jul 25, 2017 3:09 AM by tasos grigoris

    Discover paired printers

    tasos grigoris

      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.

       

      <uses-permission android:name="android.permission.BLUETOOTH" />

      <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />