react-native-touch-id-android
Fingerprint identity for Android based on https://github.com/ajalt/reprint
NOTES:
-
current latest version: v0.1.x
-
for RN < 0.47.0, use react-native-touch-id-android@0.0.5
-
An example working project is available at: https://github.com/ElekenAgency/react-native-touch-id-android/tree/master/example
Demo
Installation Android
Tested only on RN version > 0.40
-
npm install react-native-touch-id-android --save
-
react-native link react-native-touch-id-android
-
android/build.gradle
(not android/app/build.gradle, pay attention):
allprojects repositories maven // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" maven url "https://jitpack.io" // <--- add this line
android/app/src/main/java/<YOUR-APP-FOLDER>/MainApplication
file, check if you already have this lines:
; // <- add this line; // <- add this line public implements ReactApplication ... private final ReactNativeHost mReactNativeHost = this @Override protected List<ReactPackage> { return Arrays<ReactPackage>; } ; @Override public void { super; Reprint; // <- add this line } ...
- Enable fingerprint in phone's settings
Usage
Finger.isSensorAvailable()
: Promise returnstrue
if success and stringerror
in other cases (including case when you have sensor, but not enabled it in your phone's settings)
Finger ;
Finger.requestTouch()
: Promise returnstrue
if success and stringerror
in other cases.
Finger ;
Finger.dismiss()
if you open sensor and want to close it before touching (like when close app or dialog)
Example
{ Finger ; } { Finger ; } { return ... ; } { Finger }
Troubleshooting
If you made 5 wrong fingerprint attempts, Android Fingerprint API requires some time to continue work with sensor. In that case Finger.requestTouch()
returns error LOCKED_OUT
, so it would be good to make user awared that senser is temporary unavailable (near 30 seconds).
Questions or suggestions?
Feel free to open an issue