2016-10-03 41 views
1

我需要使用應用程序中的指紋打印對話來驗證用戶身份以驗證用戶身份。 I have tried this link但它表明這個錯誤Android手指在應用程序內打印本地身份驗證

註冊至少一個指紋

雖然3設備已註冊的指紋(三星S5 OS marsmallow)

+0

粘貼你的代碼,看看發生了什麼。我有相同的設備,我可以測試它 –

+0

代碼是相同的在給定的鏈接http://www.techotopia.com/index.php/An_Android_Fingerprint_Authentication_Tutorial – arsalan

回答

0
必需的Android設備

FingerprintManager類應該有內置os 6.0,否則isHardwareDetected()和hasEnrolledFingerprints()返回false S5 Android OS,v4.4.2(KitKat),可升級到v6.0(棉花糖)

final FingerprintManager fingerprintManager = getSystemService(FingerprintManager.class); 
     if(fingerprintManager.isHardwareDetected()) { 
      if (fingerprintManager.hasEnrolledFingerprints()) { 
       Toast.makeText(getApplicationContext(), "Device has FingerPrint", Toast.LENGTH_LONG).show(); 
      } 


      fingerprintManager.authenticate(new FingerprintManager.CryptoObject(criper),mCancellationSignal , 0, new FingerprintManager.AuthenticationCallback() { 
       @Override 
       public void onAuthenticationError(int errorCode, CharSequence errString) { 
        super.onAuthenticationError(errorCode, errString); 
        Toast.makeText(getApplicationContext(), "FingerPrint Not Registered", Toast.LENGTH_LONG).show(); 
        dialogue.dismiss(); 
        mCancellationSignal.cancel(); 

       } 

       @Override 
       public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) { 
        super.onAuthenticationSucceeded(result); 
        Toast.makeText(getApplicationContext(), "Authentication Successful", Toast.LENGTH_LONG).show(); 
        loginRequest(false); 
        mManage.setStringValue("name",emailtxt.getText().toString()); 
        mManage.setStringValue("pass",passwordtxt.getText().toString()); 
        mManage.setBooleanValue("TouchID",true); 
        dialogue.dismiss(); 
       } 
      }, null); 
     } 
相關問題