【问题标题】:Can I maintain a single apk to handle fingerprint scanning on Android?我可以维护一个 apk 来处理 Android 上的指纹扫描吗?
【发布时间】:2016-05-27 17:28:47
【问题描述】:

在通过Android Compatibility Definition for Android 6.0

我看到这条线: 具有安全锁屏的设备实现应该包括指纹传感器。

这是否意味着我的应用程序版本不能在运行时确定设备是否具有指纹扫描仪?如果确定它有扫描仪,它将启动指纹扫描对话框,否则只需询问 PIN/密码。

我还可以为低于 API 23 的 Android 版本使用相同的 apk 吗?

【问题讨论】:

  • Android 兼容性定义适用于设备制造商(分别是固件开发人员),而不是应用程序开发人员。

标签: android android-6.0-marshmallow fingerprint android-compatibility android-fingerprint-api


【解决方案1】:

你必须检查

  • 设备 SDK 版本
  • 存在指纹硬件
  • 指纹认证就绪(指纹已注册)

    if (Build.VERSION.SDK_INT < 23) {
        // Handle the mechanism where the SDK is older.
    }else{
        // Handle the mechanism where the SDK is 23 or later.
        FingerprintManager fingerprintManager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
        if (!fingerprintManager.isHardwareDetected()) {
            // Device doesn't support fingerprint authentication     
        } else if (!fingerprintManager.hasEnrolledFingerprints()) {
            // User hasn't enrolled any fingerprints to authenticate with 
        } else {
            // Everything is ready for fingerprint authentication 
        }
    }
    

【讨论】:

    猜你喜欢
    • 2018-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多