-2

I just ran the Google Sample, FingerprintDialog (this).

And saw that it asks for fingerprint to complete an purchase.

Its Okay, Working fine. But it uses my fingerprints saved on my device for screen unlocking.

What I want-

  • Welcome the user and ask them to provide a fingerprint.

  • Save that fingerprint. (In local storage. It might have .txt extension, if fingerprints can be saved that way).

  • And that fingerprint will be used to complete purchase on my app, rather than to use the screen unlocking fingerprint stored on device.

First of all I want to know weather its possible or not. Then, any hints to do that.

Community
  • 1
  • 1
Ravi
  • 372
  • 1
  • 7
  • 24
  • I don't think that's possible at all. Going through [one of the issues](https://github.com/googlesamples/android-FingerprintDialog/issues/20) listed in the repo, all registered fingerprints are treated equally. So you can't have the user registering a separate fingerprint for the app. At least right now, it is not possible. – Yashovardhan99 Apr 29 '18 at 06:58
  • Uh, no! I am not even aware of any Yashovardhan Raniwala. – Yashovardhan99 Apr 29 '18 at 07:07
  • See, I just want the fingerprint sensor to scan my thumb, and let the thumb impression saved in any format and then retrieve it later – Ravi Apr 29 '18 at 10:21
  • As I said, its not possible to do that. I am yet to come across a way to get an app to store a fingerprint data and then use it to authenticate a user for that app. The only way to use fingerprint for authentication is by using the method used in the repo you had linked which uses all fingerprints set in the device for authentication. Moreover, fingerprint data cannot be saved or retrieved by an app in any format. It is handled entirely by the system and the app only gets a response on whether the authentication was successful or not – Yashovardhan99 Apr 29 '18 at 14:35
  • @Yashovardhan I know that. I need someone to research on this – Ravi Apr 30 '18 at 12:58
  • Unfortunately, I don't think this is going to be ever possible. At least not in the near future due to the security risks involved. If you wish to research, I suggest reading [this security doc](https://source.android.com/security/authentication/fingerprint-hal) first which talks about how fingerprint data is stored and processed by the device. I also will be flagging this question to be closed as stackoverflow is not meant for researching things but for solving problems. In your case, this problem cannot be solved now. – Yashovardhan99 May 01 '18 at 13:25

1 Answers1

0

Due to security restrictions imposed by the android system, it is not possible for an app to input and store fingerprint data and use it for verification. An app can only authenticate the user using the stored fingerprints in the device

Fingerprint authentication is handled by the HAL. To authenticate a user using fingerprint, an app requests the system and then the system checks for the fingerprint placed on the sensor and matches it with the fingerprints stored in the device. The system then tells the app whether the authentication was successful or not.

At no point, is the app provided with any fingerprint data. So to answer your question, it is not possible. At least not with the current security measures in android.

Yashovardhan99
  • 887
  • 11
  • 26
  • 1
    _"an application is not even allowed to display its own dialog"_ Sure it is. In fact, until Android P apps pretty much had to show their own authentication UI since the `FingerprintManager` doesn't provide any UI for you. Google have now added a standard UI that you _can_ use, through the `FingerprintDialog`class, but it's only available on Android P (though maybe they'll add it to one of the support libraries). – Michael May 02 '18 at 08:20
  • @Michael sorry I was actually reading the fingerprint dialog doc for Android P and got a bit confused when writing this answer. I've made the necessary correction. Thank you! – Yashovardhan99 May 02 '18 at 09:08
  • @Michael Is it possible to change the UI of Fingerprint Prompt in Android P ? – Ravi May 02 '18 at 10:54
  • @RaviPrakash: If you're using the new `FingerprintDialog` class I only think you can change the text shown in the dialog, not the overall appearance. However, you should still be able to use the old `FingerprintManager` class and supply your own authentication UI, even when targeting Android P. There's always the risk that Google will remove that class eventually in some future version of Android, since it has now been marked as deprecated. – Michael May 02 '18 at 11:29