Enterprise Service Usage – GBG IDscan Documentation

Enterprise Service Usage

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

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
EnterpriseService.EXCEPTION_ERRORReturns when Web service experienced unrecoverable situation and returns localised exception message.
EnterpriseService.EXCEPTION_SERVER_UNREACHABLEHost unreachable – bad URL or no internet connection.
EnterpriseService.EXCEPTION_TIMEOUTWeb client time out
500Internal server error, more information on server side. 
408Server time out
401Unauthorised, possibly bad credentials. 
400Bad Request
Other error HTTP status codes possible: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Was this page helpful?