Reputation: 1435
I am working with Ionic 3 and i just added a Fingerprint plugin
Reference :Fingerprint AIO Plugin
And the code snippet is shown below
import { FingerprintAIO } from "@ionic-native/fingerprint-aio/ngx";
constructor(private fingerPrintProvider : FingerprintAIO ){}
this.fingerPrintProvider.isAvailable().then((result)=>{
console.log(result);
if(result == 'finger' || result == 'face'){
//Fingerprint or Face auth available
console.log('Fingerprint or face exist!');
self.fingerPrintProvider.show({
clientId: 'RetraxFingerPrint',
clientSecret: 'RetraxFingerPrint', //Only necessary for Android
disableBackup: true, //Only for Android(optional)
localizedFallbackTitle: 'Use Pin', //Only for iOS
localizedReason: 'Please Authenticate' //Only for iOS
})
.then((result)=>{
console.log(result);
})
.catch((error) => {
//Fingerprint/Face was not successfully verified
console.log(error);
});
}
else {
//Fingerprint or Face Auth is not available
console.log("Fingerprint/Face Auth is not available on this device!")
}
})
RxJs version is shown below
"rxjs": "5.5.2"
Other Dependencies shown below
"dependencies": {
"@angular/animations": "5.0.3",
"@angular/common": "5.0.3",
"@angular/compiler": "5.0.3",
"@angular/compiler-cli": "5.0.3",
"@angular/core": "5.0.3",
"@angular/forms": "5.0.3",
"@angular/http": "5.0.3",
"@angular/platform-browser": "5.0.3",
"@angular/platform-browser-dynamic": "5.0.3",
"@ionic-native/android-permissions": "^4.12.2",
"@ionic-native/badge": "^4.18.0",
"@ionic-native/camera": "^4.7.0",
"@ionic-native/core": "4.4.0",
"@ionic-native/crop": "^4.7.0",
"@ionic-native/deeplinks": "^4.6.0",
"@ionic-native/document-viewer": "^4.11.0",
"@ionic-native/file": "^4.7.0",
}
But when i do ionic serve i get this below error, Is it a dependency issue or any issue with the code ?
TypeError: Object(...) is not a function at FingerprintAIO.isAvailable
Any help appreciated.
Upvotes: 2
Views: 956
Reputation: 11
You should run this command :
npm install @ionic-native/[email protected]
Upvotes: 0
Reputation: 21
You should downgrade version of plugin to @4.. From Ionic 3 documentation:
$ ionic cordova plugin add cordova-plugin-fingerprint-aio
$ npm install --save @ionic-native/fingerprint-aio@4
And also export without /ngx
https://ionicframework.com/docs/v3/native/fingerprint-aio/
Upvotes: 2