I need help printing in a GX420t

// Expert user has replied.
c cesar villalon 3 years 7 months ago
11 1 0

Hi I done a android app and I need to print recieps, I am connection the printer via USB to the android tablet an sending a basic message
 
String tmpHeader = "^XA"+ "^FO50,50^ADN,36,20^FDxxxxxxxxxxx^FS"+ "^XZ";
 
  arregloBytes = tmpHeader.getBytes();
 
 
 
   public void startPrinting(final UsbDevice printerDevice)
 
  {
   Handler handler = new Handler();
   handler.post(new Runnable()
  {
   UsbDeviceConnection conn;
   UsbInterface usbInterface;

   //@RequiresApi(api = Build.VERSION_CODES.N)
   @Override
   public void run()
  {
   try
  {
   for (int i = 0; i printerDevice.getInterfaceCount(); i++)
  {
  usbInterface = printerDevice.getInterface(i);
  }
   UsbEndpoint endPoint = usbInterface.getEndpoint(0);
  conn = mUsbManager.openDevice(mDevice);
   conn.claimInterface(usbInterface, true);
   //conn.bulkTransfer(endPoint, arregloLogo, arregloLogo.length, 0);
   conn.bulkTransfer(endPoint, arregloBytes, arregloBytes.length, 0);
   mPromise.resolve(arregloBytes.toString());
  mPromise = null;
   conn.close();
  
  }
   catch (Exception e)
  {
   mPromise.reject(e);
  mPromise = null;
   Log.e("Exception", "Unable to transfer bulk data");
   e.printStackTrace();
  }

  }
  });
  }

 
the response is successful but it doesn't print anything.
 
I use the same code from printing in other printer and it works perfectly
thank you for your help
 

Please Register or Login to post a reply

1 Replies

M Manuel Caicedo-Rivera

Hi Cesar,

Please, could you clarify what type of printer is printing correctly.

My suggestion would be that you verify if the printer is correctly configured. You can verity it with our Zebra Setup Utilities tools. Please, go to the following link, and download the apps (desktop app & the Android app). Send the same ZPL code through the open communication port and check it. These utilities apps would help you to verify what is happening with your printer.

Printer Setup Utilities | Zebra

If after the tests done you still have a technical issue affecting your printer, you will need to open a case with our Technical support team on the link below.

Zebra Customer Community

Thanks,
MC

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