package uz.myid.sdk.sample import android.content.Intent import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import uz.myid.android.sdk.capture.MyIdClient import uz.myid.android.sdk.capture.MyIdConfig import uz.myid.android.sdk.capture.MyIdException import uz.myid.android.sdk.capture.MyIdResult import uz.myid.android.sdk.capture.MyIdResultListener import uz.myid.android.sdk.capture.model.MyIdBuildMode class ExampleWithOnActivityResultActivity : AppCompatActivity(), MyIdResultListener { private val client = MyIdClient() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) startMyId() } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) client.handleActivityResult(resultCode, this) } override fun onSuccess(result: MyIdResult) { // Get face bitmap and result code } override fun onError(e: MyIdException) { // Get error message and code } override fun onUserExited() { // User exited sdk } private fun startMyId() { val clientId = "client_id" val clientHash = "client_hash" val clientHashId = "client_hash_id" val passportData = "passport_data" val dateOfBirth = "date_of_birth" val config = MyIdConfig.Builder(clientId) .withClientHash(clientHash, clientHashId) .withPassportData(passportData) .withBirthDate(dateOfBirth) .withBuildMode(MyIdBuildMode.PRODUCTION) .build() /* Start the flow. 1 should be your request code (customize as needed). Must be an Activity or Fragment (support library). This request code will be important for you on onActivityResult() to identify the MyIdResultListener. */ client.startActivityForResult(this, 1, config) } }