3 Replies Latest reply on Mar 2, 2016 5:33 AM by Stephen Brennan

    Test printer status in Android

    Stephen Brennan

      I am developing an Android app which prints to a Zebra ZQ520 printer, over a Bluetooth connection, using the ZSDK API.  I would like to be able test if the connection to the printer is active or if I need to reconnect (eg when the printer has gone to sleep).  I have tried using the printer.getCurrentStatus() method, with the intention of then using the isReadyToPrint flag, but I am consistently getting a ZebraPrinterConnectionException ("Malformed status response - unable to determine printer status").  Is there any other way to check the printer/connection status?

        • Re: Test printer status in Android
          Manuel Caicedo-Rivera

          Hi Stephen,


          Please, follow the example below. It should work fine to check the status of the printer before to send a print job.

          Also, you can go to the link below to get more information about Zebra's API.

          Zebra API for Android (build v2.9.2275)


          package test.zebra.sdk.printer.examples;


          import com.zebra.sdk.comm.Connection;

          import com.zebra.sdk.comm.ConnectionException;

          import com.zebra.sdk.comm.BluetoothConnection;

          import com.zebra.sdk.printer.PrinterStatus;

          import com.zebra.sdk.printer.ZebraPrinter;

          import com.zebra.sdk.printer.ZebraPrinterFactory;

          import com.zebra.sdk.printer.ZebraPrinterLanguageUnknownException;


          public class PrinterStatusExample {


               public static void main(String[] args) throws Exception {

              Connection connection = new BluetoothConnection(theBTMacAddress);

                   try {


                       ZebraPrinter printer = ZebraPrinterFactory.getInstance(connection);


                       PrinterStatus printerStatus = printer.getCurrentStatus();

                       if (printerStatus.isReadyToPrint) {

                           System.out.println("Ready To Print");

                       } else if (printerStatus.isPaused) {

                           System.out.println("Cannot Print because the printer is paused.");

                       } else if (printerStatus.isHeadOpen) {

                           System.out.println("Cannot Print because the printer head is open.");

                       } else if (printerStatus.isPaperOut) {

                           System.out.println("Cannot Print because the paper is out.");

                       } else {

                           System.out.println("Cannot Print.");


                   } catch (ConnectionException e) {


                   } catch (ZebraPrinterLanguageUnknownException e) {


                   } finally {





          2 of 2 people found this helpful
          • Re: Test printer status in Android
            Stephen Brennan

            Thanks Manuel.  I downloaded the latest version of the SDK and actually found the answer in the included demo app.  For the ZQ520, I needed to get the status using ZebraPrinterLinkOs.


            Full code:


            ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.createLinkOsPrinter(printer);


            PrinterStatus printerStatus = (linkOsPrinter != null) ? linkOsPrinter.getCurrentStatus() : printer.getCurrentStatus();