Simple Upload Operation – GBG IDscan 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

CodeDescription
400Bad Request
401Unauthorized, possibly bad credentials.
408Server time out
500Internal server error, more information on the server side.
EnterpriseService.EXCEPTION_ERRORReturns when Web service experienced an unrecoverable situation and returns a localized exception message.
EnterpriseService.EXCEPTION_SERVER_UNREACHABLEHost unreachable – bad URL or no internet connection.
EnterpriseService.EXCEPTION_TIMEOUTWeb client time out
Other error HTTP status codes possible  https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

Was this page helpful?