face unlock using Confirm Credentials api
Asked Answered
P

2

12

I am using confirm credentials api in my app to authenticate user, using createConfirmDeviceCredentialIntent api.

The api is working fine when I have set up my device lock as pin/pattern/password or fingerprint. But, it's not working in the case of face unlock. I've set face unlock in my device and it's working fine when opening the device. But when I launch the intent using the above mentioned api, it's not recognizing face unlock but all the other things.

Is this a limitation of this api? or I've to do something extra to achieve this?

Can't find this anywhere so posting here.

Prong answered 5/2, 2018 at 13:50 Comment(2)
What device is this? And are you using Trusted face?Marcoux
The device is one plus 3t. Yes, I am able to unlock the device using my face, but it doesn't work on the confirmCredentials screenProng
M
20

Unfortunately, this isn't possible because unlocking using your face is part of the Smart Lock set of unlock tools.

Other methods of unlocking that fall under the Smart Lock category include:

  • On-body detection
  • Trusted places
  • Trusted devices
  • Trusted face (the method in question)
  • Trusted voice

Because none of these are primitive security methods in Android, it does not make sense to allow these to be accessed using APIs.

If Smart Lock could be used with Keyguard, on-body detection would be in theory be able to grant access to an app, being in a trusted place (but not in the hands of a trusted person) and even trusted voice could be used.

Apple and Face ID can allow this because Face ID is a primitive security method for the iPhone X, as the data used to unlock the device is kept in the Secure Enclave, in the same way that Touch ID data is.

I hope this gives you enough reason as to why this isn't possible, and why it makes sense that this isn't possible.

Sources: Keyguard (stating unlock methods allowed to be used), Smart Lock, Face ID

Marcoux answered 14/2, 2018 at 21:58 Comment(0)
S
7

BiometricPrompt is introduced in API 28. It will support fingerprint, Iris and face authentication.

Here's an example of how a developer might use it in their app

enter image description here

java.lang.Object
   ↳    android.hardware.biometrics.BiometricPrompt

enter image description here

Using the BiometricPrompt builder we can:

setTitle() — Set the title to display (Required)

setSubtitle() — Set the subtitle to display (Optional)

setDescription() — Set the description to display(Optional)

setNegativeButton() — Set the text for the negative button(Required).

You must also provide an Executor instance and a click listener for the negative button.

Note: You can’t customise the icon or error message that are used within the dialog.

implementation 'androidx.biometric:biometric:1.0.0-beta01'

Latest Release

GitHub source code available here NativeBiometricScanner developed in Kotlin

Stokehole answered 20/7, 2018 at 6:0 Comment(6)
BiometricPrompt is introduced in API 27 -- Its API 28Routinize
Thanks. Updated @PunK_l_RuLzStokehole
I implemented BiometricPrompt it's working in phone both fingerprint and face Id. But in my tablet have only on faceid. it showing hadware not detected error code 12. Is there any solution for it?Cholecystectomy
@ShobanaVelmurugan fingerprint is the reason it works on phone. Face Id is part of smart lock (alternate) without hardware.Stokehole
@Ask4125 Thank you. Then how to work with Tablet without hardware?Cholecystectomy
@ShobanaVelmurugan Unfortunately biometric API will not work on it. you may need to implement custom lock.Stokehole

© 2022 - 2024 — McMap. All rights reserved.