Sunmi A4 Printer Developer Document

Developer document for the Sunmi A4 printer, covering AIDL connection steps, pseudocode, API methods and error codes.


Sunmi A4 Printer Developer Document - cover page
Brand
商米
Category
Other device
Document type
User Manual
Language
Chinese
Pages
7
File format
PDF
File size
264 KB
Published
30 November, 2026
Updated
30 November, 2026
MD5 checksum
11A8072E6A668D7F3912165F6DD65683

About this manual

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.

What's inside

  • 简介
  • 连接方式
  • 伪代码示例
  • 接口API
  • 附录 错误码表
  • 打印机状态表

Specifications

Supported paper sizesA4, A5
Image formatJPG
Print resolution200dpi
Printer status values40+ states
Printable states12, 13, 14, 15, 16, 17

Frequently asked questions

How do I establish a connection to the A4 printer?

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.

Does a successful API return mean the print job succeeded?

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.

What does return code -1 mean?

Code -1 means the printer is offline or not ready.

What does return code -2 mean?

Code -2 means the cache is full and print data is not accepted.

Download PDF (264 KB)