2021-02-07-Android-Device-Lock

Module specific build.bradle

implementation "androidx.biometric:biometric-ktx:1.2.0-alpha02"

A function to perform Touch ID or Device Auth

private fun performBioAuth() {
    // Here this is a fragment
    BioAuth.performAuth(this) { success, errCode, errString ->
        if (success) {
            Log.d("BioAuth", "Complete. ToDo Next")
            // let's say perform login!
        } else {
            // oops. show error to user
            Log.d("BioAuth", "Failed ${errCode ?: 0}, ${errString ?: ""}")
        }
    }
}

A function to setup buttons

  • To show Touch ID button or not

  • To show Device passcode button or not

An object to handle Authentication

Last updated

Was this helpful?