Skip to content

Instantly share code, notes, and snippets.

@OleksandrKucherenko
Created February 7, 2020 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OleksandrKucherenko/8476c772ff05f59f70bba8b783f53f76 to your computer and use it in GitHub Desktop.
Save OleksandrKucherenko/8476c772ff05f59f70bba8b783f53f76 to your computer and use it in GitHub Desktop.
@Test
@Config(sdk = Build.VERSION_CODES.LOLLIPOP)
public void testFingerprintNoHardware_api21() throws Exception {
// GIVEN: API21 android version
ReactApplicationContext context = getRNContext();
KeychainModule module = new KeychainModule(context);
// WHEN: verify availability
final int result = BiometricManager.from(context).canAuthenticate();
final boolean isFingerprintAvailable = module.isFingerprintAuthAvailable();
// THEN: in api lower 23 - biometric is not available at all
assertThat(isFingerprintAvailable, is(false));
assertThat(result, is(BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE));
// fingerprint hardware not available, minimal API for fingerprint is api23, Android 6.0
// https://developer.android.com/about/versions/marshmallow/android-6.0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment