The legacy fingerprint authentication using Fingerprint Manager with the new AndroidX MasterKey.
Step 1: Add this your root build.gradle
repositories {
...
maven { url "https://jitpack.io" }
}
Step 2: Add this your app build.gradle
dependencies {
implementation 'com.github.pisalcoding:android-fingerprint-auth:Tag'
}
Step 3: Usage
class MainActivity : AppCompatActivity() {
private fun authenticate(
doOnSuccess: BiometricSuccessBlock,
doOnFailure: BiometricFailureBlock,
) {
val fingerprintFragment = FingerprintDialogFragment.newInstance()
FingerprintAuth.from(this)
.withDialogView(fingerprintFragment)
.doOnSuccess {
Log.d("FingerprintAuth", "Successful!. Here you can access encrypted sharedpreference wrapped in CredentailsKeeper.")
doOnSuccess(this)
}
.doOnFailure {
Log.d("FingerprintAuth", "Failed: $it")
doOnFailure(it)
}
.authenticate()
}
}
data class Credentials(
val username: String,
val pin: String,
) : ICredentials
For more details, check the sample 'app'.