两种方法都是硬件检测()和hasEnrolledFingerprints()始终返回false。我发现目标API 24工作正常,所以这只是25的问题。我想使用最新的API,但没有工作指纹就不可能。
活动
FingerprintManagerCompat from = FingerprintManagerCompat.from(getApplication());
boolean hardwareDetected = from.isHardwareDetected();
boolean b = from.hasEnrolledFingerprints();
app.gradle
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.tkuhn.myapplication"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
testCompile 'junit:junit:4.12'
}
答案 0 :(得分:5)
较新的支持库存在的问题来自于他们现在正在积极检查设备系统功能以包含1[MyProj.Services.DataServices.Circle.Outputs.Interfaces.ICircleProfile] parser' of constructor 'Void .ctor(MyProj.Services.DataServices.Circle.QueryBuilders.Interfaces.ICircleProfileQueryBuilder, MyProj.Services.DataServices.Circle.QueryProcessors.Interfaces.ICircleQueryProcessor, MyProj.Services.DataServices.Circle.Parsers.Interfaces.ICircleParser
。看起来受影响的设备即使具有指纹传感器也没有在其配置中指定此功能。这是设备制造商方面的错误。
这是FEATURE_FINGERPRINT
的签到将返回FingerprintManagerCompat
false
您可以尝试Reprint或RxFingerpring作为替代解决方案。
答案 1 :(得分:5)
充分利用FingerprintManager
& FingerprintManagerCompat
。
对旧设备使用{{1>}的 isHardwareDetected ,FingerprintManagerCompat
的 isHardwareDetected 适用于新设备。
FingerprintManager
答案 2 :(得分:1)
FingerprintManager manager = (FingerprintManager) getSystemService(FINGERPRINT_SERVICE);
if (manager.isHardwareDetected()) {
//code here
}
希望这个帮助
答案 3 :(得分:0)
您可以使用已解决此问题的最新AndroidX FingerprintManagerCompat
:
API级别23上的FingerprintManagerCompat#getFingerprintManagerOrNull 不应检查PackageManager(b/124066957)
Google Issue Tracker故障单报告说,支持库进行了以下检查:
mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)
即使扫描仪存在并且指纹为 配置,并且FingerprintManager可以用于身份验证。 ... 我们需要更新FingerprintManagerCompat,它还会检查PackageManager。在API23上,该标志不存在
他们在androidx.core:core-ktx:1.1.0-rc02
中所做的工作。