Android M FingerprintManager.isHardwareDetected()在Samsung Galaxy S5上返回false

前端之家收集整理的这篇文章主要介绍了Android M FingerprintManager.isHardwareDetected()在Samsung Galaxy S5上返回false前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚刚更新了一个Verizion三星Galaxy S5(SM-G900V)到G900VVRU2DPD1版本通过手册说明列出在 http://www.androidofficer.com/2016/06/g900vvru2dpd1-android-601-marshmallow.html

当我运行下面的代码时,isHardwareDetected()返回’false’.我会期望它返回“真实”.

我已经完成的谷歌没有以任何方式导致任何信息,因为在棉花糖支持S5指纹读取器.

有人有任何关于S5指纹读取器的信息吗?

FingerprintManager manager = (FingerprintManager) getSystemService(FINGERPRINT_SERVICE);
    if (manager != null) {

        if (ActivityCompat.checkSelfPermission(this,permission.USE_FINGERPRINT) !=
                PackageManager.PERMISSION_GRANTED) {
            retVal.append(INDENT).append("Fingerprint permission was not granted")
                    .append(EOL);
        } else {
            retVal.append(INDENT).append("Fingerprint hardware detected: ")
                    .append(manager.isHardwareDetected()).append(EOL);
            retVal.append(INDENT).append("Has Enrolled Fingerprint(s): ")
                    .append(manager.hasEnrolledFingerprints()).append(EOL);
        }
    } else {
        retVal.append(INDENT).append("no FingerprintManager available").append(EOL);
    }

解决方法

终于解决了.看起来android的默认API不能处理一些三星设备,所以解决方案是为这个问题添加三星库.

您可以在这里找到一些文档和库:http://developer.samsung.com/galaxy/pass

添加库后,您必须向清单添加新的权限:

<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />

最后,您可以使用这种方法

private boolean isFingerprintSupported() {
  boolean isFingerprintSupported = fingerprintManager != null && fingerprintManager.isHardwareDetected();
  if (!isFingerprintSupported && SsdkVendorCheck.isSamsungDevice()) {
    Spass spass = new Spass();
    try {
        spass.initialize(context);
        isFingerprintSupported = spass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT);
    } catch (SsdkUnsupportedException | UnsupportedOperationException e) {
        // Error handling
    }
  }
  return isFingerprintSupported;
}

猜你在找的Android相关文章