Developer document for the Sunmi A4 printer, covering AIDL connection steps, pseudocode, API methods and error codes.
This document explains how to use the Sunmi A4 printer on self-service devices through the API interfaces provided by Sunmi. It covers connection methods, pseudocode examples, interface APIs and an appendix of error codes.
Connecting to the printer uses AIDL, the Android Interface Definition Language, which defines the inter-process communication interface. The document lists five steps for establishing the connection, from adding the AIDL file to unbinding the service when the application exits, and provides pseudocode for binding the service, creating a print job and releasing the connection. This manual is written in Chinese.
| Supported paper sizes | A4, A5 |
|---|---|
| Image format | JPG |
| Print resolution | 200dpi |
| Printer status values | 40+ states |
| Printable states | 12, 13, 14, 15, 16, 17 |
Add the AIDL file, implement ServiceConnection, call bindService, convert the IBinder with ExtPrinterService.Stub.asInterface(service), then call the AIDL methods. Call unbindService when the application exits.
No. The printer executes print tasks and sends data asynchronously, so the interface return only indicates that the print service received the instruction. The printer may still be in an abnormal state such as out of paper.
Code -1 means the printer is offline or not ready.
Code -2 means the cache is full and print data is not accepted.