private FingerprintManager CreateFingerprintManager() { string Tag = "FingerprintManager"; BioAuthnCallback callback = new FidoBioAuthnCallback(); return(new FingerprintManager(this, Executors.NewSingleThreadExecutor(), callback)); }
private void OnClickFaceAuthWithCrpObj(object sender, EventArgs e) { string Tag = "FaceAuthWithCrpObj"; Android.Content.PM.Permission permissionCheck = Android.Content.PM.Permission.Granted; if (Build.VERSION.SdkInt >= BuildVersionCodes.M) { permissionCheck = CheckSelfPermission(Manifest.Permission.Camera); } if (permissionCheck != Android.Content.PM.Permission.Granted) { log.Info(Tag, "The camera permission is not enabled. Please enable it."); // request camera permissions if (Build.VERSION.SdkInt >= BuildVersionCodes.M) { RequestPermissions(new string[] { Manifest.Permission.Camera }, 1); } return; } BioAuthnCallback callback = new FidoBioAuthnCallback(); // Cancellation Signal CancellationSignal cancellationSignal = new CancellationSignal(); FaceManager faceManager = new FaceManager(this); log.Info(Tag, $"IsHardwareDetected:{faceManager.IsHardwareDetected}"); // Checks whether 3D facial authentication can be used. int errorCode = faceManager.CanAuth(); if (errorCode != 0) { log.Info(Tag, "Can not authenticate. errorCode=" + errorCode); return; } // flags int flags = 0; // Authentication messsage handler. Handler handler = null; // Recommended CryptoObject to be set to null. KeyStore is not associated with face authentication in current // version. KeyGenParameterSpec.Builder.setUserAuthenticationRequired() must be set false in this scenario. CryptoObject crypto = null; log.Info(Tag, "Start face authentication.\nAuthenticating......\n"); faceManager.Auth(crypto, cancellationSignal, flags, callback, handler); }