Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android FingerprintManager not supported for API lower than 23 #65

Closed
MasterDaveh opened this issue Jan 3, 2018 · 7 comments
Closed

Comments

@MasterDaveh
Copy link

I was testing the module on a couple of devices with respectively API level 21 and 17.
With both of the devices I could manage to install the signed release APK but the app would just crash saying "the app has stopped".
From the Logcat in Android Studio I managed to get a stacktrace with a java.lang.RuntimeException: Could not invoke FingerprintAuth.isSupported error.
I then bumped into this SO answer which states that "FingerprintManager is supported in API 23 and Higher", which is confirmed here.

The same APK is working on a Nexus 5X with Android version 8, so API level should be 26.

Are there any known workarounds at the moment?

@szczepcio95
Copy link

Any ideas? Having the same problem

@szczepcio95
Copy link

Okey, I've got something. Just before authenticating try this

if (Platform.OS === 'android' && Platform.Version <= 23 ) {
            // not performing any TouchID actions
        }

@marcorm
Copy link

marcorm commented Feb 13, 2018

I think, in

FingerprintAuthModule.java

this:

  public void isSupported(Callback reactErrorCallback, Callback reactSuccessCallback) {
    keyguardManager = (KeyguardManager) getCurrentActivity().getSystemService(Context.KEYGUARD_SERVICE);
    fingerprintManager = (FingerprintManager) getCurrentActivity().getSystemService(Context.FINGERPRINT_SERVICE);
    if(!isFingerprintAuthAvailable()) {
      reactErrorCallback.invoke("Not supported.");
    } else {
      reactSuccessCallback.invoke("Is supported.");
    }
    return ;
  }

should become something like:

  public void isSupported(Callback reactErrorCallback, Callback reactSuccessCallback) {
    if(!isFingerprintAuthAvailable()) {
      reactErrorCallback.invoke("Not supported.");
    } else {
      keyguardManager = (KeyguardManager) getCurrentActivity().getSystemService(Context.KEYGUARD_SERVICE);
      fingerprintManager = (FingerprintManager) getCurrentActivity().getSystemService(Context.FINGERPRINT_SERVICE);
      reactSuccessCallback.invoke("Is supported.");
    }
    return ;
  }

Correct me if i'm wrong...

gazaret added a commit to gazaret/react-native-touch-id that referenced this issue Mar 5, 2018
@gazaret
Copy link

gazaret commented Mar 5, 2018

Fixed in #96

@marcorm
Copy link

marcorm commented Mar 5, 2018

Hi @gazaret , are you sure your solution work? Because the solution i proposed is unstable...

@gazaret
Copy link

gazaret commented Mar 5, 2018

Hi @marcorm , yes it was unstable on api 23+.
Now fixed this.
Tested on android 4.4 and 7.0. It works.

markrickert pushed a commit to markrickert/react-native-touch-id that referenced this issue May 1, 2018
@zibs
Copy link
Collaborator

zibs commented Jun 30, 2018

We now have some handling for this in 4.0.3 - please give it a shot and let us know by opening a new issue if the problem persists.

@zibs zibs closed this as completed Jun 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants