On This Page
Custom Card Read
Follow these steps to perform a custom card read.
- Retrieve theReadCardIntentvalue from themposUiobject and use thestartActivitymethod to initiate the card read flow.val ReadCardIntent = mposUi.createReadCardIntent() startActivityForResult(ReadCardIntent, MposUi.REQUEST_CODE_READ_CARD)
- After the card read activity is completed, theonActivityResultmethod is triggered. This action returns information about the status of the card read activity and the card details.override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == MposUi.REQUEST_CODE_READ_CARD) { when (resultCode) { // Result code from a successful card read MposUi.RESULT_CODE_READ_CARD_SUCCESS -> { Toast.makeText(findViewById(android.R.id.content), "Card read successful", Toast.LENGTH_LONG).show() } // Result code from a failed card read MposUi.RESULT_CODE_READ_CARD_FAILED -> { Toast.makeText(findViewById(android.R.id.content), "Card read failed", Toast.LENGTH_LONG).show() } } } }