Skip to content

Instantly share code, notes, and snippets.

@flschweiger
Last active October 30, 2016 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flschweiger/d99eb8b1fe6ef8e2c9cabece04e5f8be to your computer and use it in GitHub Desktop.
Save flschweiger/d99eb8b1fe6ef8e2c9cabece04e5f8be to your computer and use it in GitHub Desktop.
A class which extends FingerprintManager.AuthenticationCallback.
class AuthCallbacks extends FingerprintManager.AuthenticationCallback {
@Override
public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) {
// Called when a fingerprint is recognized.
// The AuthenticationResult contains the CryptoObject which
// has been passed to the authenticate() method.
Cipher cipher = result.getCryptoObject().getCipher();
// Go on and use the 'unlocked' Cipher object...
}
@Override
public void onAuthenticationError(int errorCode, CharSequence errString) {
// Called when an unrecoverable error has been encountered and
// the operation is complete. No further callbacks will be
// made on this object.
}
@Override
public void onAuthenticationFailed() {
// Called when a fingerprint is valid but not recognized.
}
@Override
public void onAuthenticationHelp(int helpCode, CharSequence helpString) {
// Called when a recoverable error has been encountered
// during authentication. The help string is provided to
// give the user guidance for what went wrong, such as
// "Sensor dirty, please clean it."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment