Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android BiometricPrompt: Cannot resolve symbol PromptInfo

When I copied the following code from this developer.android.com tutorial about adding biometric authentication in your android app:

BiometricPrompt.PromptInfo promptInfo =
            new BiometricPrompt.PromptInfo.Builder()
            .setTitle("Biometric login for my app")
            .setSubtitle("Log in using your biometric credential")
            .setNegativeButtonText("Cancel")
            .build();

PromptInfo is not recognized.

I have followed all the steps prior to this in the tutorial.

like image 226
Vansh Arora Avatar asked Oct 16 '19 17:10

Vansh Arora


1 Answers

You need to add this dependency:

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

And make sure you use this import:

import androidx.biometric.BiometricPrompt;

and not

import android.hardware.biometrics.BiometricPrompt;

Update: for the current version check: https://mvnrepository.com/artifact/androidx.biometric/biometric?repo=google

like image 74
Traendy Avatar answered Nov 01 '22 18:11

Traendy