StarXpand SDK for iOS/Android Developer's Manual Ver. 1.14.0

Last update: Sep. 15, 2026

Use Cash Drawer

The procedure and the reference vary depending on the OS. Select the OS to display.

iOS Android


This section describes the structures of StarPRNT SDK and StarXpand SDK for cash drawer operations.

Understand the differences between these SDKs before migrating to StarXpand SDK.


StarPRNT SDK

Use the appendPeripheral() method in Generate Printing Data to generate printing data for opening the cash drawer.
Sample code: Refer to the createPeripheralData() method in ApiFunctions.swift (GitHub).
To monitor the cash drawer status, set an instance conforming to the StarIoExtManagerDelegate protocol to the delegate property of the StarIoExtManager class, as described in Monitor Printer Status.
Calling connect() in this state causes the following appropriate delegate method to be executed when the open/close status of the cash drawer changes.
func didCashDrawerOpen(_ manager: StarIoExtManager!) {
    print("Cash Drawer: Open")
}

func didCashDrawerClose(_ manager: StarIoExtManager!) {
    print("Cash Drawer: Close")
}

Sample code (GitHub)


StarXpand SDK

To open the cash drawer, generate a DrawerBuilder class instance in Generate Printing Data and use the actionOpen() method.
Pass this instance as an argument to the addDrawer() method of the DocumentBuilder instance.
Sample code (GitHub)

To monitor the cash drawer status, set an object conforming to the DrawerDelegate protocol to the StarPrinter.drawerDelegate property.
Calling open() in this state causes the corresponding delegate method to be executed when the open/close status of the cash drawer connected to the printer changes.
func drawer(printer: StarPrinter, communicationErrorDidOccur error: Error) {
    print("Drawer: Communication Error")
}

func drawer(printer: StarPrinter, didSwitch openCloseSignal: Bool) {
    print("Drawer: Open Close Signal Switched: \(openCloseSignal)")
}

The delegate methods corresponding to cash drawer events are as follows:
Sample code (GitHub)

Refer to Supported API List for information on whether each API is supported in StarPRNT SDK and StarXpand SDK.

This section describes the structures of StarPRNT SDK and StarXpand SDK for cash drawer operations.

Understand the differences between these SDKs before migrating to StarXpand SDK.


StarPRNT SDK

Use the appendPeripheral() method in Generate Printing Data to generate printing data for opening the cash drawer.
Sample code: Refer to the createPeripheralData() method in ApiFunctions.java (GitHub).
To monitor the cash drawer status, specify an instance implementing the IStarIoExtManagerListener interface in the StarIoExtManager class constructor, as described in Monitor Printer Status.
Calling connect() in this state causes the following appropriate listener method to be executed when the open/close status of the cash drawer changes.
override fun onCashDrawerOpen() {
    Log.d(TAG, "Cash Drawer: Open")
}

override fun onCashDrawerClose() {
    Log.d(TAG, "Cash Drawer: Close")
}

Sample code (GitHub)


StarXpand SDK

To open the cash drawer, generate a DrawerBuilder class instance in Generate Printing Data and use the actionOpen() method.
Pass this instance as an argument to the addDrawer() method of the DocumentBuilder instance.
Sample code (GitHub)

To monitor the cash drawer status, set an object implementing the DrawerDelegate interface to the StarPrinter.drawerDelegate property.
Calling openAsync() in this state causes the corresponding callback method to be executed when the open/close status of the cash drawer connected to the printer changes.
override fun onCommunicationError(e: StarIO10Exception) {
    Log.d(TAG, "Drawer: Communication Error")
}

override fun onOpenCloseSignalSwitched(openCloseSignal: Boolean) {
    Log.d(TAG, "Drawer: Open Close Signal Switched: $openCloseSignal")
}

The callback methods corresponding to cash drawer events are as follows:
Sample code (GitHub)

Refer to Supported API List for information on whether each API is supported in StarPRNT SDK and StarXpand SDK.