Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cancel Fingerprint scanner

I am working on a program that has a security function including a PIN and a fingerprint, but now I'm having a problem with entering the password (PIN or Fingerprint). Incorporating the correct fingerprints is fine, but when I enter the PIN code, after I exit the PIN and fingerprint activity, the machine continues to listen for fingerprints, I know this because when I click on the "home" button "The machine still vibrates slightly, so there is no way to stop listening to fingerprints?

like image 522
Mạnh Duy Nguyễn Avatar asked May 15 '17 09:05

Mạnh Duy Nguyễn


People also ask

How do I turn off my fingerprint sensor always?

To turn this feature off, open the “Settings” app on your phone and access the “Biometrics and security” menu. Next, access the “Fingerprints” section and enter your pattern or code. And finally, disable the “Fingerprint always on” toggle.

Can you bypass a fingerprint scanner?

Using Forged Fingerprints to Crack the Security If the hacker can't get an unsecured image, they can choose to create a fingerprint instead. This trick involves getting a hold of the target's prints and recreating them to bypass the scanner.


2 Answers

When you start up the fingerprint reader, you pass in a CancellationSignal.

When you want to cancel (maybe in the OnPause on your Activity), just call the cancel method of this object.

There is a complete sample here.

like image 123
Kuffs Avatar answered Oct 13 '22 02:10

Kuffs


You can cancel the Finger scan listener by using the CancellationSignal object. Check below code:

private CancellationSignal cancellationSignal;
...
...
public void startFingerAuth(FingerprintManager manager, FingerprintManager.CryptoObject cryptoObject) {
    if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT)
            != PackageManager.PERMISSION_GRANTED) {
        return;
    }
    cancellationSignal = new CancellationSignal();
    manager.authenticate(cryptoObject, cancellationSignal, 0, this, null);
}


public void stopFingerAuth(){
    if(cancellationSignal != null && !cancellationSignal.isCanceled()){
        cancellationSignal.cancel();
    }
}

You have to call this method stopFingerAuth() in your activity or fragment.

like image 3
Hantash Nadeem Avatar answered Oct 13 '22 01:10

Hantash Nadeem