Interaction
After setting the correct parameters and initializing XpressPlug, you can execute it. To do it, invoke the Sdk.start() method.
Insert the code block below on the Activity tab from where you want XpressPlug to be executed.
XpressPlug.start(this, new StartAction.Callback() {
In the example above, the start() method needs two parameters: the Activity parameter, that indicates where XpressPlug is executing from, and the StartAction.Callback() interface. This interface is in charge of returning the process status. When implemented, the project requests you to complete a series of callback methods.
@Override public void onProgressMessageUpdate(String status) { } @Override public void onProgressPercentageUpdate(int percentage) { } @Override public void onFinish() { } @Override public void onXpressPlugNeedsUpdate() { } @Override public void onError(int errorCode, String description) { } });
Callback Methods
Callback methods return different information about XpressPlug and its process status. See the table below to learn more:
onProgressMessageUpdate | Is in charge of returning the XpressPlug's status to the main application. |
onProgressPercentageUpdate | XpressPlug needs data connection to update certain functionalities. This function is in charge of showing the download progress for these updates. |
XpressPlugNeedsUpdate | Is in charge of displaying if the application needs a more recent version of XpressPlug. |
onFinish | Notifies that the start () method was executed correctly. |
onError | Notifies that there was an error executing XpressPlug. It displays UA error codes and, in some cases, an error description. To learn more about these errors, go to Mobile Error Codes. |
Interacting with XpressPlug
You can interact with XpressPlug and call for entrypoints. These entrypoints are used to connect with Veritran's functionalities, such as processes or transactions.
Entrypoints can be visual, like invoking a screen that opens the device's camera to take a picture, or non-visual, such as validating a login. To interact with these entrypoints, enter the syntax below:
com.veritran.xpressplug.EntryPoint action = XpressPlug.buildEntryPoint(“NAME_EP”,activity); action.setCallback(new com.veritran.xpressplug.EntryPoint.Callback() {
On the name field next to the buildEntryPoint method, enter the functionality's name that is set in Studio. Both fields need to match in order to work correctly.
Interacting with the entrypoint returns a series of callback methods you need to complete. See the code and table below for more information on how to complete them.
@Override public void onCompleted(Response response) { } @Override public void onException(String action, Exception e) { } @Override public void onUpdateRequired(String s) { } @Override public void onClose(String s, Activity activity) { } });
onCompleted | This is where the output parameters appear. |
onException | Executed when an exception occurs. |
onUpdateRequired | Displays when the SDK or configuration need to be updated. |
onClose | Displays when the functionality is closed |
Lastly, execute the call by sending the input parameters on the following syntax:
action.addInput("PARAMETER_NAME_1","VALUE_1"); action.addInput("PARAMETER_NAME_2","VALUE_2"); action.execute();
Important
Both the entrypoint name and the parameter name need to match what is set in Studio on the SKD Configuration page of your application.