Get Journey Details
If you are interested in retrieving aggregated results about your journey, you can use the retrieval function called getJourney().
First, we need EnterpriseService instance.
For retrieving, create listener OnGetJourneyListener.
Java: getJourney()
EnterpriseService enterprise = new EnterpriseService(getApplicationContext());enterprise.setBaseUrl(“https://baseUrl.idscan.cloud/”);enterprise.getJourney("JourneyID", new Credentials("user","password"), mGetJourneyListener);For kotlin example best would be to reuse Enterprise Service instance we created before.
Kotlin: getJourney()
enterpriseService?.getJourney(journeyID, onGetJourneyListener = journeyListener)
Callback of getJourney() us OnGetJourneyListener:
Java
// Response of get details (Retrieval)private OnGetJourneyListener mGetJourneyListener = new OnGetJourneyListener() { @Override public void onGetJourney(@Nullable ResponseJourney responseJourney) {}
@Override public void onError(int code, @NonNull String message) {}};Kotlin
private val mGetJourneyListener = object : OnGetJourneyListener { override fun onGetJourney(responseJourney: ResponseJourney?) { // Succesfull response about journey }
private val mGetJourneyListener = object : OnGetJourneyListener { override fun onGetJourney(responseJourney: ResponseJourney?) { // Succesfull response about journey }
override fun onError(code: Int, message: String) { when (code) { // Example code for handling issues. EnterpriseService.EXCEPTION_SERVER_UNREACHABLE -> mView.showRetryDialog(R.string.progress_server_unreachable_title) EnterpriseService.EXCEPTION_TIMEOUT -> mView.showRetryDialog(R.string.progress_timeout_title) else -> mView.finishWithError(code, message, mJourneyID) } } }Possible onError() codes
| Code | Description |
|---|---|
| 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 |
| 500 | Internal server error, more information on the server side. |
| 408 | Server time out |
| 401 | Unauthorized, possibly bad credentials. |
| 400 | Bad Request |
| … | Other error HTTP status codes possible https://en.wikipedia.org/wiki/List_of_HTTP_status_codes |
| For more information check JavaDocs on possible call exceptions. |