Reputation: 3265
On Android, I would like to biometrically distinguish which user is using my app. I am not looking to have direct access to their raw fingerprint data, or face recognition.
I am just assuming that more than one user might be using the phone. Is there a way that I can tell which one? I am looking for a unique user id, not a picture or anything like that. An answer such as "User1 is using the fingerprint sensor" is enough; My app does not need to know the user's finger scan or their email. I just want to distinguish User1 from User2.
For example: An android user can setup multiple fingers on their fingerprint sensor. CanI somehow tell which finger number was scanned when BiometricPrompt was called by my app. (Finger1? Finger2, etc...)
When running in a debugger, I see that result
has a mUserId
field, but this is allways 0.
new BiometricPrompt.AuthenticationCallback() {
@Override
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
// Can I write something here to figure out which user is using this phone?
Is this possible? If not, then what is mUserId
for?
Upvotes: 0
Views: 189
Reputation: 58457
The current API doesn't support what you're trying to do. It essentially gives you a Yes/No answer to the question "Is the currently scanned fingerprint/face/iris enrolled on this device?". That's it.
then what is mUserId for?
I'm pretty sure it refers to the UID of current process, i.e. a unique value that identifies the app's kernel-level application sandbox.
In any case, getUserId
is annotated @hide
in the BiometricAuthenticator.AuthenticationResult
source code, which means that apps aren't supposed to use it. And if you look in the BiometricPrompt
source code, you can see that they always set the field to 0 when constructing the AuthenticationResult
.
Upvotes: 1