https://blog.csdn.net/createchance/article/details/51991764
指纹解锁的知识点:
1.在manifest文件声明权限
android:name="android.permission.USE_FINGERPRINT"
2.检查运行条件
1)apiLevel23 ;
google推荐使用 Android Support Library v4包来获得FingerprintManagerCompat对象,因为在获得的时候这个包会检查当前系统平台的版本。
2)硬件
fingerprintManager.isHardwareDetected()
3)设备必须处于安全保护中
keyguardManager.isKeyguardSecure()
4)系统中必须有指纹的注册
fingerprintManager.hasEnrolledFingerprints()
3.指纹认证,app需要及时通知用户当前的操作以及操作的结果,比如需要明确告诉用户当前正在扫描指纹,请把你的指纹放在传感器上等。
CryptoObjectHelper cryptoObjectHelper = new CryptoObjectHelper();
fingerprintManager.authenticate(cryptoObjectHelper.buildCryptoObject(), 0,
cancellationSignal, myAuthCallback, null);
4.处理扫描结果
MyAuthCallback extends FingerprintManagerCompat.AuthenticationCallback