yourfriendken / local_auth_device_credentials

BSD 3-Clause "New" or "Revised" License
5 stars 7 forks source link

I can't proceed Beyond the fingerprint #2

Open Pey-crypto opened 4 years ago

Pey-crypto commented 4 years ago

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.hardware.fingerprint.FingerprintManager.hasEnrolledFingerprints()' on a null object reference

The app had no problems running in a biometric phone but has problems running in a non-biometric phone

aghanti7 commented 4 years ago

Same problem here. There are (unfortunately) some new Android phones which have only face unlock and no fingerprint hardware. Would love to fallback to phone pin in such cases.

Pey-crypto commented 4 years ago

Actually kinda weird...i just read AuthenticationHelper.java. The code does utilize androidx.biometric.BiometricPrompt, but I noticed that the fallback has not been set in promptInfo in the else statement

Adding .setDeviceCredentialAllowed(true) in else statement might fix the problem...but this is not even a solution

Pey-crypto commented 4 years ago
`//` API 23 - 28 with fingerprint
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
  FingerprintManager fingerprintManager = (FingerprintManager) context
      .getSystemService(Context.FINGERPRINT_SERVICE);
  if (fingerprintManager.hasEnrolledFingerprints()) {
    authHelper = new AuthenticationHelper(lifecycle, (FragmentActivity) activity, call, completionHandler,
        false);
    authHelper.authenticate();
    return;
  }
}

// API 23 or higher with device credentials
KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(KEYGUARD_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && keyguardManager.isDeviceSecure()) {
  String title = call.argument("signInTitle");
  String reason = call.argument("localizedReason");
  Intent authIntent = keyguardManager.createConfirmDeviceCredentialIntent(title, reason);
  activity.startActivityForResult(authIntent, LOCK_REQUEST_CODE);
  return;
}``

This block can be avoided Androidx is already handling everything from Android 6 to the latest version

kennethj commented 4 years ago

@Pey-crypto @aghanti7 Is this on physical phones or on emulators? What phones/emulators are you using?

Pey-crypto commented 4 years ago

Physical Phones such as alcatel 1x or Nokia 1...These devices run android 8 or higher but do not have a fingerprint scanner https://www.gsmarena.com/alcatel_1x-9086.php

kennethj commented 4 years ago

This is difficult to reproduce. I only have Pixel 1-3 phones for testing and Android 8 emulators appear to always show fingerprint as available hardware – even when emulating a phone that does not have that hardware.

I added some additional hardware and enrollment checks in #3, but I am not sure that addresses the issue reported.

Pey-crypto commented 4 years ago

The issue still exists. Kinda frustrating is it possible to add an Fingerprint Check at Fingerprint Manager https://developer.android.com/reference/android/hardware/fingerprint/FingerprintManager#FINGERPRINT_ERROR_HW_NOT_PRESENT

Renatinaveen commented 4 years ago

In Iphone if faceid is enabled it shows enter passcode or password to proceed instead of asking for faceid.