Android fingerprint identification development example
There is too little information about Android m fingerprint. After reading the native Android code for a period of time, I wrote the following examples and contributed them to people in need.
The following content is based on 64 bit Qualcomm CPU and fpc1020 chip. This part of the code has been changed on the native Android to cope with the factory fingerprint test. The native Android fingerprint needs to be collected 10 times (depending on different chips).
Brief description of code:
1. Fingerprintenrollbase class:
The important thing is
Java code
This interface.
1) onenrollmenthelp function: refers to the fingerprint operation help information returned by the lower layer.
2) onenrollmenterror function is the error information returned by the lower layer, and errmsgid is the error information type, where 1 indicates that the fingerprint hardware is unavailable, 3 indicates timeout, and 5 indicates that the operation has been cancelled. Errstring is the text message corresponding to errmsgid. If necessary, you can do your own experiments.
3) onenrollmentprogresschange() function displays the collection status of the current fingerprint. Steps: the total number of entries required; Remaining is the number of remaining times. I have printed the log in this function.
2. Fingerprintactivity is the main activity class and fingerprintenrollbase is the fingerprint base class.
In particular, there is a sentence in the fingerprintenrollbase class: private byte [] mtoken = new byte [69]; Normally, this array is applied to Hal layer through framework layer after entering the password. In order to save the code for verifying that block, the value calculated by sizeof (hw_auth_token_t) is 69. If necessary, please calculate accordingly. I have experimented in the code. If this array is not 69 (on 64 bit CPU), it will directly lead to the program crash!
FPC fingerprint acquisition flow chart:
The source code is as follows:
FingerPrintEnrollBase:
Java code
FingerPrintActivity:
Java code
The above is the sorting of Android fingerprint data. We will continue to supplement relevant data in the future. Thank you for your support to this site!