Using TouchID on emulator

Mourad Idrissi picture Mourad Idrissi · Jan 19, 2017 · Viewed 10.2k times · Source

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 ?

Answer

José Neto picture José Neto · Jan 19, 2017

Yes is possible!

With the simulator open you click in Hardware -> Touch ID Enrolled to make the Touch ID active

Touch ID Enrolled

To test the Touch ID you go in Hardware -> Simulate Finger Touch -> Matching or Non-Matching

Simulate Finger Touch