Biometrics entries are unique per device. When the user disable their biometrics, their biometrics enrollment for that device will be deleted from the database. When they enable biometrics, they are essentially enrolling that device again for biometrics, and therefore they will be prompted to verify the biometrics again.
To do enable/disable biometrics, you have to initialize Cotter's biometrics prompt first using:
onSuccess will be called when the biometric is successfully enabled or disabled.
If the user successfully disabled biometrics, we will call onSuccess(false). So enrolled = false here, because biometrics is no longer enrolled.
If the user successfully enabled biometrics, we will call onSuccess(true).
onCanceled
onCanceled will be called when the user try to enable biometrics, but they canceled the biometric prompt (dismissed the prompt).
onError
onError will be caleld when an error occur while enabling or disabling biometrics.
2. Initialize Cotter Biometric
You have to initialize Cotter Biometric before using it to enable or disable
Example:
3. Enable Biometric
Remember, you have to initialize Cotter Biometric first before calling this function.
4. Disable Biometric
Remember, you have to initialize Cotter Biometric first before calling this function.
5. Checking the Enrolled status of Biometric after enable/disable
You can check again if the biometric is correctly enabled/disabled using the function below:
Check if Methods are Enrolled
You can check if an authentication method is enrolled and available for a user.
1. Check if Biometric is available
This method is used to check if biometric is available on the user's device. You need to provide a callback of type CotterMethodChecker to handle the result.
Example:
2. Check if Biometrics is enrolled in the current device
This method is used to check if biometric is enrolled. You need to provide a callback of type CotterMethodChecker to handle the result.
Example:
3. Check if Pin is enrolled
This method is used to check if pin is enrolled. You need to provide a callback of type CotterMethodChecker to handle the result.
Example:
Change Pin
Starting the PinChange flow is exactly the same as starting the PinEnrollment flow.
Cotter.methods.biometricAvailable(new CotterMethodChecker() {
@Override
public void onCheck(boolean b) {
// Check if biometric available and enabled
bioAvailable.setText("Biometric available: " + b);
}
});
Cotter.methods.pinEnrolled(new CotterMethodChecker() {
@Override
public void onCheck(boolean b) {
// Check if biometric available and enabled
pinEnrolled.setText("Pin Enrolled: " + b);
}
});
// Inside your app, use a button onClick that calls
// openPinChange to start the flow
public void openPinChange(View view) {
Cotter.PinChange.startFlow(view, Dashboard.class, "PIN_CHANGE");
}