Search code examples
androidandroid-fingerprint-api

.isHardwareDetected() does not execute


I want to implement a Fingerprint sensor verification function for android. So I implemented this Java function, which is called by other one:

public boolean checkSensor (){
   Context context=this.cordova.getActivity().getApplicationContext(); 
   FingerprintManager fingerprintManager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
   // runs like a charm
   boolean abc = fingerprintManager.isHardwareDetected();
   // doesn't reach this step. function is terminated with error
   return abc;
   }

Any suggestion?


Solution

  • Already managed to figure it out. It was a problem with the User Permissions (not edited correctly on the plugin.xml).

    Just add

    <config-file target="AndroidManifest.xml" parent="/*">
        <uses-permission android:name="android.permission.USE_FINGERPRINT" />
    </config-file>
    

    under the and it runs like a charm.