我们可以对它们执行不同的功能吗? 我需要将这些 API 用于我的项目,并且感到困惑,因为如果 API 认为所有指纹都相同。以及不同的指纹如何保存并用于不同的操作? 搜索了 API 并找到了这些。
API 中的这些行是什么意思?
public static class AuthenticationResult {
private Fingerprint mFingerprint;
private CryptoObject mCryptoObject;
/**
* Authentication result
*
* @param crypto the crypto object
* @param fingerprint the recognized fingerprint data, if allowed.
* @hide
*/
public AuthenticationResult(CryptoObject crypto, Fingerprint fingerprint) {
mCryptoObject = crypto;
mFingerprint = fingerprint;
}
/**
* Obtain the crypto object associated with this transaction
* @return crypto object provided to {@link FingerprintManager#authenticate(CryptoObject,
* CancellationSignal, int, AuthenticationCallback, Handler)}.
*/
public CryptoObject getCryptoObject() { return mCryptoObject; }
/**
* Obtain the Fingerprint associated with this operation. Applications are strongly
* discouraged from associating specific fingers with specific applications or operations.
*
* @hide
*/
public Fingerprint getFingerprint() { return mFingerprint; }
};
最佳答案
对于普通的 Android,目前所有的指纹都被认为是平等的。 https://github.com/googlesamples/android-FingerprintDialog/issues/20
正如 mariotaku 在底部所说,有一种方法可以使用隐藏的 API 来区分指纹。但这可能会在未来的版本中中断。
/** * Obtain the Fingerprint associated with this operation. Applications are strongly * discouraged from associating specific fingers with specific applications or operations. * * @hide */ public Fingerprint getFingerprint() { return mFingerprint; }
不是代码块中的@hide
。这意味着此函数不可用公开,因此您必须使用反射来访问它。
边注:
根据此链接,可以使用不同的指纹手势在较新的华为手机上启动不同的应用程序。 https://www.reddit.com/r/Nexus6P/comments/42p8ba/different_fingerprint_launches_different_app/
进一步观察,这其实与读取不同的指纹无关,而是通过指纹传感器上的手势来执行不同的 Action 。这些手势可以用任何手指来执行,而不仅仅是注册为身份验证指纹的手指。 http://www.androidcentral.com/how-enable-fingerprint-gestures-honor-6x
关于android - 是否可以在Android的指纹API中识别多个手指?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38359040/