我假设在棉花糖之前没有支持OS的手机支持指纹API。
我的问题是:
(a)使用棉花糖发布的所有/任何三星手机都支持android指纹API
(b)操作系统升级为棉花糖的三星手机是否支持Android指纹API?
我读过这些:
Fingerprint scanner not detected when using Android 6.0 Fingerprint API on Samsung S5
Samsung galaxy note 4 fingerprint not found
Android FingerPrint API isHardwareDetected returns false for Samsung Note 4
Devices with fingerprint sensor above 6.0 which are not using Android fingerprint SDK
但没有明确的答案。三星网站还提到所有三星设备都支持Pass SDK,但未提及android指纹API支持
答案 0 :(得分:1)
在我下面的评论中更清楚地了解了要求之后 答案,这里是更新的答案
Pass是负责Samsung设备指纹功能的SDK。您可以做什么,可以检查设备是否使用Pass
SDK。
下面是检查它的代码:
FingerprintManager fingerprintManager = (FingerprintManager) getApplicationContext().getSystemService(Context.FINGERPRINT_SERVICE);
boolean isFingerprintSupported = fingerprintManager != null && fingerprintManager.isHardwareDetected();
if (!isFingerprintSupported && SsdkVendorCheck.isSamsungDevice()) { // for samsung devices which doesn't support Native Android Fingerprint API
Spass spass = new Spass();
try {
spass.initialize(context);
isFingerprintSupported = spass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT);
} catch (SsdkUnsupportedException | UnsupportedOperationException e) {
//Error handling here
}
} else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // for devices which doesn't support Pass SDK
FingerprintManager fingerprintManager = (FingerprintManager) getApplicationContext().getSystemService(Context.FINGERPRINT_SERVICE);
if (!fingerprintManager.isHardwareDetected()) {
// This device is not supporting fingerprint authentication
} else if (!fingerprintManager.hasEnrolledFingerprints()) {
// User hasn't enrolled any fingerprints to authenticate with
} else {
// Everything is ready for fingerprint authentication
}
}
}
向AndroidManifest.xml添加以下权限。
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
我希望这会有所帮助。
答案 1 :(得分:1)
根据我的经验,我可以肯定地告诉您,即使在Android M及更高版本上,几部三星手机仍继续使用Spass库。例如,现在我正在移动操作系统上进行测试:Android 6.0.1(Galaxy Note 4 Edge)。 我已经编写了一些代码,以这种方式将输出打印到日志中:
/*
* This function evaluates which fingerprint helper should be instantiated (if any)
*/
public static FingerprintHelper initializeFingerprintHelper(Context context){
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
FingerprintManager manager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
if (manager != null) {
logger.info("Android native fingerprint manager exists");
if (manager.isHardwareDetected()) {
logger.info("Android native fingerprint manager detected hardware");
if (manager.hasEnrolledFingerprints()) {
logger.info("Android native fingerprint manager has enrolled fingerprints");
}else{
logger.info("Android native fingerprint manager has no enrolled fingerprints");
}
return new AndroidFingerprintHelper(context);
}
}
}
try{
logger.info("Android native fingerprint manager is null, trying Samsung SPASS rollback");
Spass spass = new Spass();
spass.initialize(context);
if(spass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT)){
return new SamsungFingerprintHelper(context);
}
} catch (SsdkUnsupportedException e) {
logger.error("Spass library is missing on the device");
}
return null;
}
从控制台的日志中,我看到尽管设备上的Android版本为M(6.0.1)-方法
manager.isHardwareDetected()
返回false,该方法转到Spass lib初始化,并成功。因此,该设备肯定在android M上使用了Spass库。
答案 2 :(得分:0)
通过我的小调查,a发现了以下内容。 Pass API将有助于三星设备,该设备在android 6之前具有指纹API。 是带指纹的2014年度的设备。设备列表可在此处找到。 https://en.wikipedia.org/wiki/Samsung_Galaxy 主要设备:
即使将android更新到6版本,它们也不支持标准的Google FingerPrint Api。