package uz.myid.sdk.sample; import static uz.myid.android.sdk.capture.MyIdResultKt.takeUserResult; import android.content.Intent; import android.os.Bundle; import androidx.activity.result.ActivityResultLauncher; import androidx.annotation.NonNull; 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; public class ExampleJavaActivity extends AppCompatActivity implements MyIdResultListener { private final MyIdClient client = new MyIdClient(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); startMyId(); } @Override public void onSuccess(@NonNull MyIdResult result) { // Get face bitmap, result code, comparison value } @Override public void onError(@NonNull MyIdException e) { // Get error message and code } @Override public void onUserExited() { // User exited sdk } private void startMyId() { String clientId = "client_id"; String clientHash = "client_hash"; String clientHashId = "client_hash_id"; String passportData = "passport_data"; String dateOfBirth = "date_of_birth"; MyIdConfig config = new MyIdConfig.Builder(clientId) .withClientHash(clientHash, clientHashId) .withPassportData(passportData) .withBirthDate(dateOfBirth) .withBuildMode(MyIdBuildMode.PRODUCTION) .build(); Intent intent = client.createIntent(this, config); result.launch(intent); } private final ActivityResultLauncher result = takeUserResult(this, this); }