This is an expandable Android fingerprint api compatible lib, which also combine these api:

Android API: Minimum Support for Android 6.0

SamSung SDK: Minimum Support for Android 4.2 (More detail)

MeiZu SDK: Minimum Support for Android 5.1 (more detail)

Api Priority level: Android > Samsung > MeiZu

Chinese version introduction – Portal

1. Gradle

The compile 'com. Wei. Android. Lib: fingerprintidentify: 1.2.0'Copy the code

2. AndroidManifest

<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
<uses-permission android:name="com.fingerprints.service.ACCESS_FINGERPRINT_MANAGER"/>
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY"/>
Copy the code

3. FingerprintIdentify api

mFingerprintIdentify = new FingerprintIdentify(this);                       // create object
mFingerprintIdentify = new FingerprintIdentify(this, exceptionListener);    // exception callback for develop only
mFingerprintIdentify.isFingerprintEnable();                                 // is fingerprint usable
mFingerprintIdentify.isHardwareEnable();                                    // is hardware usable
mFingerprintIdentify.isRegisteredFingerprint();                             // is fingerprint collected
mFingerprintIdentify.startIdentify(maxTimes, listener);                     // start identify
mFingerprintIdentify.cancelIdentify();                                      // cancel identify
mFingerprintIdentify.resumeIdentify();                                      // resume identify
Copy the code

4. startIdentify method

mFingerprintIdentify.startIdentify(3, new BaseFingerprint.FingerprintIdentifyListener() {
    @Override
    public void onSucceed() {
        // succeed, release hardware automatically
    }

    @Override
    public void onNotMatch(int availableTimes) {
        // not match, try again automatically
    }

    @Override
    public void onFailed(boolean isDeviceLocked) {
        // failed, release hardware automatically
        // isDeviceLocked: is device locked temporarily
    }
});
Copy the code

5. Proguard

# MeiZuFingerprint
-keep class com.fingerprints.service.** { *; }

# SmsungFingerprint
-keep class com.samsung.android.sdk.** { *; }
Copy the code

6. Notice

1. Usually, device will be locked temporarily when read incorrect fingerprints continuously 5 times. And it need to takes about 30 seconds to get back to normal. But it's not standardized, MeiZu SDK has no limit to this. 2. The About 'com. Android. Support: appcompat - v7:25.3.1' version of The class FingerprintManagerCompatApi23 will check the feature FEATURE_FINGERPRINT from version 25. More info: https://code.google.com/p/android/issues/detail?id=231939 3. Some manufacturers will transplant standard fingerprint API  to the device which version less than Android M, such as OPPO. But the API will be modified sometimes and cause calling crash, such as VIVO. 4. We need to check the manufacturers because Meizu's sdk is available on some other devices. 5. MeiZu's The SDK runs abnormally on MeiLan Note3 sometimes, it can't switch to mback mode event called release.Copy the code

7. Version Update

V1.2.02017.07.10 Add android M limit. Add new callback parameter to notice is that device locked temporarily.

V1.1.52017.06.14 FingerprintIdentify (Activity) — – > FingerprintIdentify (Context).

V1.1.42017.05.24 Remove android M limit, add MeiZu manufacturer verify. See ISSUE#12

V1.1.32017.05.22 Update the method getFingerprintManager. See ISSUE#11

V1.1.22017.04.25 Modify AOSP’s code, avoid the PackageManager.FEATURE_FINGERPRINT limit.

V1.1.12017.03.20 Modify gradle AppCompat lib version.

V1.1.02017.03.16 Modify package name and bug fixed.

V1.0.22017.02.17 Add exception callback.

V1.0.12017.02.15 Bug fixed.

V1.0.02017.02.10 Release v1.

License

Licensed under the MIT License, see the LICENSE for copying permission.