Skip to content
GBG Documents & Biometrics Documentation

Simple Upload Operation

To begin with, one must initialise 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
400 Bad Request
401 Unauthorized, possibly bad credentials.
408 Server time out
500 Internal server error, more information on the server side.
EnterpriseService.EXCEPTION_ERROR Returns when Web service experienced an unrecoverable situation and returns a localized exception message.
EnterpriseService.EXCEPTION_SERVER_UNREACHABLE Host unreachable – bad URL or no internet connection.
EnterpriseService.EXCEPTION_TIMEOUT Web client time out
… Other error HTTP status codes possible  https://en.wikipedia.org/wiki/List_of_HTTP_status_codes