This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void biometricPromptDialog() { | |
BiometricManager biometricManager = BiometricManager.from(this); | |
switch (biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK | BiometricManager.Authenticators.DEVICE_CREDENTIAL)) { | |
case BiometricManager.BIOMETRIC_SUCCESS: | |
Log.d("MY_APP_TAG", "App can authenticate using biometrics."); | |
break; | |
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE: | |
Log.e("MY_APP_TAG", "No biometric features available on this device."); | |
b.biometricCardView.setVisibility(View.GONE); | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BiometricManager biometricManager = BiometricManager.from(this); | |
switch (biometricManager.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_WEAK | BiometricManager.Authenticators.DEVICE_CREDENTIAL)) { | |
case BiometricManager.BIOMETRIC_SUCCESS: | |
Log.d("MY_APP_TAG", "App can authenticate using biometrics."); | |
break; | |
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE: | |
Log.e("MY_APP_TAG", "No biometric features available on this device."); | |
b.biometricCardView.setVisibility(View.GONE); | |
break; | |
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Executor executor = ContextCompat.getMainExecutor(this); | |
BiometricPrompt biometricPrompt = new BiometricPrompt(this, executor, new BiometricPrompt.AuthenticationCallback() { | |
@Override | |
public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) { | |
super.onAuthenticationError(errorCode, errString); | |
viewEditAndSave(); | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder() | |
.setTitle(getString(R.string.biometric_title)) | |
.setSubtitle(getString(R.string.biometric_subtitle)) | |
.setDescription(getString(R.string.biometric_desc)) | |
.setAllowedAuthenticators(BiometricManager.Authenticators.BIOMETRIC_WEAK | BiometricManager.Authenticators.DEVICE_CREDENTIAL) | |
.setConfirmationRequired(false) | |
.build(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void qrGeneration(String qrText) { | |
QRCodeWriter writer = new QRCodeWriter(); | |
try { | |
BitMatrix bitMatrix = writer.encode(qrText, BarcodeFormat.QR_CODE, 564, 564); | |
int width = bitMatrix.getWidth(); | |
int height = bitMatrix.getHeight(); | |
Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); | |
for (int x = 0; x < width; x++) { | |
for (int y = 0; y < height; y++) { |