.isHardwareDetected()不执行

时间:2016-04-21 14:47:18

标签: android android-fingerprint-api

我想为android实现指纹传感器验证功能。所以我实现了这个Java函数,由另一个函数调用:

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;
   }

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

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.