0 Replies Latest reply on Nov 20, 2017 7:06 PM by cesar villalon

    I need help printing in a GX420t

    cesar villalon

      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