Hi Team,
I working on App development for the clover flex, I've compile my app and upload apk to clover dashboard and download to my clover flex dev kit I can initiate sale, refund using the clover android SDK and print clover transaction receipt.
Now I'm trying to print custom receipt from my app to print through the clover flex printer.
I can’t seem to get this working using PrintJobsConnector
What should I be calling to get the connection printer to the clover flex receipt printer.
I went through the below documentation, but it seems to push more towards using the Remote Pay Android Example POS which is semi-integration side.
I using the clover android SDK, therefore could you breakdown what I should be calling to connected to the clover flex printer from my app.
Furthermore, as I can seem to get connected to the clover flex
I am not getting any value on this function which is called on onCreate
- fillPrinterId(); // printerConnector.getPrinters(Category.RECEIPT) does not return anything
Same with below function which is called on button press
- getPrinter() // do not return anything
I tried implementing ViewPrintJob and TextPrintJob but nothing seems to be working there is no exception thrown and also there is no error in the printer que on the flex.
This is for ViewPrintJob :-
void viewPrintJob() { PrinterConnector pc = new PrinterConnector(this, CloverAccount.getAccount(this), null); List printerList = new ArrayList(); try { printerList = pc.getPrinters(Category.RECEIPT); Toast.makeText(getApplicationContext(), "printers : " + pc.toString(), Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), "printer connect: " + pc.isConnected(), Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), "printers list : " + pc.getPrinters().toString(), Toast.LENGTH_SHORT).show(); } catch (RemoteException e) { Toast.makeText(getApplicationContext(), "remoteExp : " + e.toString(), Toast.LENGTH_SHORT).show(); e.printStackTrace(); } catch (ClientException e) { Toast.makeText(getApplicationContext(), "clientExp : " + e.toString(), Toast.LENGTH_SHORT).show(); e.printStackTrace(); } catch (ServiceException e) { Toast.makeText(getApplicationContext(), "serviceExp : " + e.toString(), Toast.LENGTH_SHORT).show(); e.printStackTrace(); } catch (BindingException e) { Toast.makeText(getApplicationContext(), "bindExp : " + e.toString(), Toast.LENGTH_SHORT).show(); e.printStackTrace(); } if(printerList != null) Toast.makeText(getApplicationContext(), "printersList : " + String.valueOf(printerList.size()), Toast.LENGTH_SHORT).show(); else Toast.makeText(getApplicationContext(), "printersList : null" , Toast.LENGTH_SHORT).show(); assert printerList != null; if (printerList.size() > 0) { Printer preferredPrinter = (Printer) printerList.get(0); TypeDetails typeDetails = null; try { typeDetails = pc.getPrinterTypeDetails(preferredPrinter); Toast.makeText(getApplicationContext(), "typeDetails : " + typeDetails.toString(), Toast.LENGTH_SHORT).show(); } catch (RemoteException e) { e.printStackTrace(); } catch (ClientException e) { e.printStackTrace(); } catch (ServiceException e) { e.printStackTrace(); } catch (BindingException e) { e.printStackTrace(); } assert typeDetails != null; int width = typeDetails.getNumDotsWidth(); Toast.makeText(getApplicationContext(), "width : " + String.valueOf(width), Toast.LENGTH_SHORT).show(); PrintJob viewPrintJob = new ViewPrintJob.Builder() .view(linearLayout, width) .build(); viewPrintJob.print(getApplicationContext(), CloverAccount.getAccount(this), preferredPrinter); } }
Your support would be greatly appreciate
In order to create and print custom receipts, you can use ‘CloverConnector’. Please refer this link for more information: https://docs.clover.com/docs/creating-custom-receipts .
Here, section ‘Getting the device’s printer’ https://docs.clover.com/docs/creating-custom-receipts#getting-the-devices-printer explains that before calling the print function how you can get the information about available printers for your device.
While section ‘Printing a custom receipt’ https://docs.clover.com/docs/creating-custom-receipts#printing-a-custom-receipt explains how you can add an image parameter(can be of 3 types: bitmap image / image URL / array of text strings) in the print request.
Also, please refer this link: https://docs.clover.com/docs/printing-a-receipt#printing-custom-receipts which explains about the endpoint to get printer’s ID followed by the steps & requirements to print a text-based and image-based custom receipts.
https://docs.clover.com/docs/canadian-merchants#language-support : It explains that it is the best practice to match the customer’s language and locale information with the custom receipt’s language