'On a Sunmi K2 Terminal how can I print (on the build-in printer) something using WinDev Mobile?

I'm using a Sunmi K2 POS Checkout Terminal running with Android 7.1.2

I'm developing a POS software with WinDev for Mobile 26, I'm already displaying some windows, now the question is, how can I print on the build-in pos printer??

There is a print-test app on the kiosk installed, this works fine.

In the settings there is a printer settings too, but this says "no device installed"...

In the documentation there is a "AIDL interface" mentioned...

And more, there is a API sample written:

Bound Service

Intent intent = new Intent();
intent.setPackage("com.sunmi.extprinterservice");
intent.setAction("com.sunmi.extprinterservice.PrinterService");
bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);

It is necessary to establish a new ServiceConnection service to bind the callback

ServiceConnection serviceConnection = new ServiceConnection() {
@Override public void onServiceConnected(ComponentName name, IBinder service) {
ExtPrinterService ext = ExtPrinterService.Stub.asInterface(service);
}
@Override public void onServiceDisconnected(ComponentName name) { }
};

Use ext object to realize one’s own printing task

ext.printText(“123456\n”);

Unbind the service after the completion of the usage

unbindService(serviceConnection);

Question is, how can I use this Java code in WinDev Mobile??



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source