How to detect if the user add new fingerprint to Android settings after he/she authenticate finger inside my application ?
i.e. iOS have something called (evaluatedPolicyDomainState) to detect changes in fingerprint catalog what is the alternative in Android ?
This require for security reasons to prompt password in this case
From the documentation for
setUserAuthenticationRequired
:So to check if any new fingerprints have been enrolled since you created your fingerprint-associated key, just create a cipher with that key and try to
init
the cipher. If any new fingerprints have been enrolled, theinit
call should trigger aKeyPermanentlyInvalidatedException
.You can't add new fingerprints from your app.
Inside your application you only have access to the Auth Fingerprint Method which checks against registered fingerprints through the keyStore.
I can get all finger id in integers.
please refer to this: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/hardware/fingerprint/Fingerprint.java
there is a public method getFingerId( ), but it is not available for us to call because it has "@UnsupportedAppUsage".
so you need to use reflection to call the method. after you get a list of fingerprint id, you can encrypt them and store in sharedPreference.
Finger id is the id of the fingerprints stored in setting
After you get all finger ids, you can determine if user has added/deleted a fingerprint.
No need to count on the KeyPermanentlyInvalidatedException. It is not thrown in Android 8.0
Good luck!!!...
don't believe google did such a poor job