Mobile SDK
Android
MPI Extensibility
2 min
we have exposed the underlying java mpi apis to allow you to interact with miura devices outside of the sdk should you wish to do so for example, if you wanted to have a custom tip menu, you could show the menu before calling toro starttransaction() and add the tip amount in the transactionmetadata object see more about gratuities in the docid\ lehlkf6xed5jgdwpshr5e section there is a more comprehensive demo of how this can be achieved in the sample application, see in particular the services cabcard torosample ui device package and miuradeviceutil object here is a very basic code snippet showing how you could display a message on a miura device tip ensure you use the opensession and closesession methods from the toro sdk this allows the sdk to have visibility over the session state, and therefore the session will be "re used" when calling starttransaction import android util log import com miurasystems mpi api executor miuramanager import com miurasystems mpi api utils displaytextutils import com miurasystems mpi enums interfacetype import services cabcard toro toroclient import services cabcard toro core listener connectionlistener fun test(toro toroclient) { // open a session with the selected device over bluetooth or usb toro opensession(object connectionlistener { override fun onconnected() { // now you can use any of the mpi apis you want displaytext("hello, world!") toro closesession() } override fun ondisconnected() { log e("test", "disconnected from device") } override fun onconnectionattemptfailed() { log e("test", "connection attempt failed") } }) } fun displaytext(text string) { // this is the same miuramanager instance the toro sdk is using under the hood val miuramanager = miuramanager getinstance() val centeredtext = displaytextutils getcenteredtext(text) val success = miuramanager mpiclient? displaytext( interfacetype mpi, centeredtext, true, true, false ) ? false if (!success) { log e("test", "failed to display text on device?!") } } the full documentation for the available mpi apis are available on miura's website you may need to request access from them https //api miurapartners com/
