Reputation: 3785
I'm trying to use TouchID within my Ionic 2 app. I have an iphone 5c, so I can't test it on real device.
I imported the package :
import { TouchID } from 'ionic-native';
Then, I tested the first function (I already activated touchID in the hardware section of the emulator):
TouchID.isAvailable()
.then(
res => console.log('TouchID is available!'),
err => console.error('TouchID is not available', err)
);
Everything works fine. Now what I would like to do, is testing this function :
TouchID.verifyFingerprint('Scan your fingerprint please')
.then(
res => console.log('Ok', res),
err => console.error('Error', err)
);
It's possible to test it on emulator ? The emulator can listen to fingerprint action ?
Upvotes: 16
Views: 25728
Reputation: 1335
Anyone who is using latest Xcode (version 12x), there is no Hardware
menu, it's been replace by 'Feature`. So to enroll the touch id,
Features -> Touch Id -> Enrolled
Upvotes: 16
Reputation:
In new versions of xCode:
Upvotes: 1
Reputation: 3785
This is my code @josé-neto
ngOnInit() {
if(window["plugins"]){
window["plugins"].touchid.isAvailable(
function() {
console.log("isAvailable ok !");
window["plugins"].touchid.verifyFingerprint(
'Scan your fingerprint please',
function(msg) {console.log('verifyFingerprint ok: ' + JSON.stringify(msg))},
function(msg) {console.log('verifyFingerprint not ok: ' + JSON.stringify(msg))}
);
},
function(msg) {
console.log('isAvailable not ok: ' + JSON.stringify(msg))
}
);
}
else{
console.log('window["plugins"] not ok');
}
}
in the console, It displays "isAvailable ok !" then executes the function verifyFingerprint. (it display :verifyFingerprint not ok: null). It's not waiting the user action (fingerprint)
Upvotes: 0
Reputation: 540
Yes is possible!
With the simulator open you click in Hardware -> Touch ID Enrolled to make the Touch ID active
To test the Touch ID you go in Hardware -> Simulate Finger Touch -> Matching or Non-Matching
Upvotes: 20