#FingerPrint react-native module for android.
npm install git://github.com/nickhagenov/react-native-fingerprint.git#(latest commit uuid) --save
"react-native-fingerprint": "git://github.com/nickhagenov/react-native-fingerprint.git#(latest commit uuid)"
...
include ':app'
include ':react-native-fingerprint'
project(':react-native-fingerprint').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fingerprint/android')
...
dependencies {
...
compile project(":react-native-fingerprint")
}
import com.rn.fingerprint.FingerPrintPackage; // <--- import
public class MainActivity extends ReactActivity {
......
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new FingerPrintPackage() // <---- add here
);
}
......
}
.....
import FingerPrint from 'react-native-fingerprint';
.....
class TestExample extends Component {
constructor(props, context) {
super(props, context);
......
this.onFingerAuth = this.onFingerAuth.bind(this);
......
}
componentDidMount() {
......
FingerPrint.registerFingerPrintCallback(this.onFingerAuth);
FingerPrint.initializeFingerPrintAuth();
......
}
componentWillUnmount() {
......
FingerPrint.removeFingerPrintCallback();
......
}
onFingerAuth(result) {
if (result.success) {
// add codes for success functionality
} else {
// add codes for failed functionality
}
}
.....
}
......