Which Samsung devices do not support android's native fingerprint API?

前端 未结 3 2209
借酒劲吻你
借酒劲吻你 2021-02-19 23:51

I\'m assuming that no phones with OS before marshmallow support the fingerprint API.

My questions are:

(a) Do all/any Samsung phones released with marshmallow

3条回答
  •  太阳男子
    2021-02-20 00:38

    After understanding more clearly requirement from comment below my answer, here is updated answer

    Pass is the SDK responsible for Fingerprint feature for Samsung devices. What you can do, you can check if device is using Pass SDK or not.

    Below is code to check it:

        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 
                }
            }
        }
    

    Add below permissions to AndroidManifest.xml.

    
    
    

    I hope this will help.

提交回复
热议问题