package uz.myid.sdk.sample import android.os.Bundle import androidx.fragment.app.Fragment 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 import uz.myid.android.sdk.capture.takeUserResult class ExampleKotlinFragment : Fragment(), MyIdResultListener { private val client = MyIdClient() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) startMyId() } 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() val intent = client.createIntent(requireActivity(), config) result.launch(intent) } private val result = takeUserResult(this) }