question

Jeffrey Blattman avatar image
Jeffrey Blattman asked Will Macaluso commented

How can I get the state (printed, failed, etc.) of a printed receipt?

How can I get the status (printed, failed, etc.) of a printed receipt?

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered Will Macaluso commented

We've just added a new component to our Android SDK that allows you to query the state of print jobs. The interface is the class PrintJobsConnector. If you are printing the job yourself (creating the PrintJob object manually), you can query the state of it given it's ID. To obtain the ID, you must use a new interface to performing the print: PrintJobsConnector.print() which returns a print job ID. This ID can subsequently be used to call PrintJobsConnector.getState() to get the state of the print job.

If you want to query the state of print jobs printed by another app (such as the core Clover applications) you can use PrintJobsConnector.getPrintJobIds(), passing in a state to query. For example, to query for all of the IN_QUEUE print jobs,

PrintJobsConnector connector = new PrintJobsConnector(context);
List<String> ids = connector.getPrintJobIds(PrintJobsContract.STATE_IN_QUEUE);

The state of a print job is an integer, and the possible values are defined by the PrintJobsContract.STATE_* constants.

These changes will be available in the next release of the Clover Android SDK.

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Will Macaluso avatar image Will Macaluso commented ·

You guys should really include all of this printer information in your docs. It's really difficult to find these gems

1 Like 1 ·

Welcome to the
Clover Developer Community