Search code examples
androidbiometricsandroid-fingerprint-api

How to know which finger is scanned for bio-metric?


My requirement is to scan the finger and based on the finger I've to navigate user to the particular page in android

Explanation

While registering user will give different fingerprints for different functionalities

Ex:

  1. For navigating to login page user may use left index finger

  2. For navigating to About us page user may use right index finger

for each fingerprint I've to redirect to the different pages based on the user wish. For this I've checked these link1, link2 and many more but I'm unable to achieve it. Can any one give suggestion...


Solution

  • What you're asking for isn't possible, at least not using Android's Fingerprint API. The FingerprintManager class acts as a way of accessing previously-stored fingerprints within the Android keystore system

    User authentication authorizes a specific cryptographic operation associated with one key. In this mode, each operation involving such a key must be individually authorized by the user. Currently, the only means of such authorization is fingerprint authentication: FingerprintManager.authenticate. Such keys can only be generated or imported if at least one fingerprint is enrolled (see FingerprintManager.hasEnrolledFingerprints). These keys become permanently invalidated once a new fingerprint is enrolled or all fingerprints are unenrolled.

    The FingerprintManager class itself only has one authentication method, authenticate(), which determined if the scanned fingerprint is known to the device. In API 28 this is deprecated in favour of BiometricPrompt, which does pretty much the same job.

    So in short, no. You'd need to use an exteral fingerprint scanner and roll your own solution based on the functionality the external hardware provides.

    EDIT As an alternative option, you can detect swipes on the Fingerprint Sensor using FingerprintGestureController, but again, this doesn't detect which finger is being used on the sensor.