Reputation: 21
Is there a way to detect if biometric authentication has been successfully passed recently by using any method from the biometric API or any security log flag ?
I can't find one that would allow an app to check whether the biometric security has passed or any other security phone unlocking methods such as password or pattern.
There must be an internal function that allows the system to check whether the phone is unlocked or not and store it in some variable, but I can't find any.
Do you know a way to achieve this?
Upvotes: 2
Views: 944
Reputation: 5173
So if I'm getting it correct . You don't want to have a biometric check in your app but instead, want to know if a biometric check has been enabled in the system or not.
There is a way to check the security using Keyguard Manager (min API level 23).
public static boolean isDeviceSecure(Context context)
{
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
KeyguardManager manager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
return manager.isDeviceSecure();
}
}
But if you want to check specifically for biometric or each of them individually this answer might help.
Upvotes: 1