Simple Upload Operation
To begin with, one must initialize the EnterpriseService instance.
Java
EnterpriseService enterpriseService = new EnterpriseService(getApplicationContext());
enterprise.setBaseUrl(“https://baseUrl.idscan.cloud/”);
Kotlin
val enterpriseService = EnterpriseService.Builder(this)
.baseUrl(baseUrl)
.credentials(credentials)
.build()
For receiving a response from submitDocument(), add the below listener.
Java
// Response for documentSubmit()
OnDocumentSubmittedListener mDocumentSubmittedListener = new OnDocumentSubmittedListener() {
@Override
public void onDocumentUploadedResponse(@NonNull ResponseUpload responseUpload) {}
@Override
public void onError(int code, String message) {}
};
Kotlin
private val mDocumentSubmittedListener = object : OnDocumentSubmittedListener {
override fun onDocumentUploadedResponse(responseUpload: ResponseUpload?) {
// Successfull response
}
override fun onError(code: Int, message: String) {
when (code) {
// Handle error
}
}
}
Possible onError() codes:
Code | Description |
EnterpriseService.EXCEPTION_ERROR | Returns when Web service experienced unrecoverable situation and returns localised exception message. |
EnterpriseService.EXCEPTION_SERVER_UNREACHABLE | Host unreachable – bad URL or no internet connection. |
EnterpriseService.EXCEPTION_TIMEOUT | Web client time out. |
500 | Internal server error, more information on server side. |
408 | Server time out. |
401 | Unauthorised, possibly bad credentials. |
400 | Bad Request |
… | Other error HTTP status codes possible: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes |