I am currently implementing an app that uses a printer from Hoin. They provided an SDK that I can integrate in Android Studio (done) and tell me to instantiate the instance like this:
val mHoinPrinter = HoinPrinter.getInstance(context, mode, callback)
For context and mode, no biggies. For the callback I am having troubles.
In their documentation they specify that the callback is of interface PrinterCallback which is composed like so:
Public interface PrinterCallback {
Public void onState(int state); //state callback, parameter is status code, refer to status code definition
Public void onError(int errorCode); //Error callback, parameter is error code, refer to error code definition
Public void onEvent(PrinterEvent event); //Event callback, parameter is PrinterEvent event, refer to PrinterEvent definition
}
Which is great because it gives me 4 events that should be triggered at some point.
My issue is that I have no clue how to actually instantiate it. I know that I need to do it like so val mHoinPrinter = HoinPrinter.getInstance(this.context, 2, callback) but where I have troubles is in defining the callback. Should I write a function? should I setup something extra? How can I define logics for this callback?
It's very confusing when reading the docs online.