Usage
MobbScan Gateway Android has been designed to be extremely easy to use. Here are the necessary steps:
1. Initialize the library
Start the library by providing an activity context.
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// ...
MscGateway.initialize(this)
// ...
}
}
2. Start the process
To start the process, you need to call the launch method with the following parameters:
gatewayUrl: The URL of the MobbScan Gateway environment.onboardingToken: The token used to perform the operations.scanId: The ID used to identify a concrete operation.callback: The implementation of theMscGatewayCallbackcallback to handle the process result.
NOTE: If you have any questions about how to obtain the values for
gatewayUrl,onboardingToken, andscanId, please contact support.
val mscGateway = MscGateway.getInstance()
val callback: MscGatewayCallback = object : MscGatewayCallback {
override fun onSuccess() {
// TODO: handle success
}
override fun onError(error: MobbScanGatewayError) {
// TODO: handle error
}
}
mscGateway.launch(gatewayUrl, onboardingToken, scanId, callback)
2.1. Error Handling
If an error occurs and the process cannot be completed, the onError function of the MscGatewayCallback callback will be invoked, providing an instance of type MobbScanGatewayError as a parameter. You can check all possible error types by referring to the available implementations of MobbScanGatewayError.
