android指紋解鎖,支持Android原生6.0及以上+魅族+三星,借鑑github上的寫法,代碼簡單,幾個類,庫沒有導入其餘的第三方包,乾淨整潔。android
apk下載連接 https://github.com/supertaohaili/fingerprint/blob/master/app-debug.apkgit
github:https://github.com/supertaohaili/fingerprintgithub
allprojects { repositories { ... maven { url 'https://jitpack.io' } } } dependencies { compile 'com.github.supertaohaili:fingerprint:1.0.0' }
示例代碼:app
mFingerprintIdentify = new FingerprintIdentify(this, null); mFingerprintIdentify.startIdentify(MAX_AVAILABLE_TIMES, new BaseFingerprint.FingerprintIdentifyListener() { @Override public void onSucceed() { Toast.makeText(MainActivity.this, "解鎖成功", Toast.LENGTH_SHORT).show(); tvMsg.setTextColor(Color.parseColor("#ff333333")); tvMsg.setText("解鎖成功"); } @Override public void onNotMatch(int availableTimes) { Log.e("Fingerprint", "onNotMatch"); tvMsg.setTextColor(Color.parseColor("#ffff0101")); tvMsg.setText("密碼錯了,還可輸入" + availableTimes + "次"); translate(ivZhiwen); } @Override public void onFailed(boolean isDeviceLocked) { tvMsg.setTextColor(Color.parseColor("#ffff0101")); tvMsg.setText("指紋驗證太過頻繁,請稍後重試或者輸入密碼登陸"); mTimeCount.start(); translate(ivZhiwen); } @Override public void onStartFailedByDeviceLocked() { tvMsg.setTextColor(Color.parseColor("#ffff0101")); tvMsg.setText("指紋驗證太過頻繁,請稍後重試或者輸入密碼登陸"); mTimeCount.start(); translate(ivZhiwen); } }); @Override public void onPause() { super.onPause(); if (mFingerprintIdentify != null) { mFingerprintIdentify.cancelIdentify(); } } @Override protected void onResume() { super.onResume(); if (mFingerprintIdentify != null) { mFingerprintIdentify.resumeIdentify(); } } @Override protected void onDestroy() { super.onDestroy(); if (mFingerprintIdentify != null) { mFingerprintIdentify.cancelIdentify(); } }
混淆文件maven
# MeiZuFingerprint -keep class com.fingerprints.service.** { *; } # SmsungFingerprint -keep class com.samsung.android.sdk.** { *; }
If you have any questions/queries/Bugs/Hugs please mail @ taohailili@gmail.comide