安卓指纹识别 SDK,兼容魅族和三星的 6.0 及以下系统

1,513 阅读1分钟
原文链接: github.com

This is an expandable Android fingerprint api compatible lib, which also combine Samsung and MeiZu's official fingerprint api.

Samsung and MeiZu's fingerprint SDK supports most devices which system versions less than Android 6.0 .

Api priority level:Android > Samsung > MeiZu

中文版

1. Gradle

compile 'com.wei.android.lib:fingerprintidentify:1.1.2'

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"/>

3. FingerprintIdentify api

mFingerprintIdentify = new FingerprintIdentify(this);                       // create object
mFingerprintIdentify = new FingerprintIdentify(this, exceptionListener);    // create with error listener
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

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() {
        // failed, release hardware automatically
    }
});

5. Proguard

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

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

6. Notice

code.google.com/p/android/i…

7. Version Update

v1.1.2 2017.04.25 Modify AOSP's code,avoid the PackageManager.FEATURE_FINGERPRINT limit.

v1.1.1 2017.03.20 Modify gradle AppCompat lib version.

v1.1.0 2017.03.16 Modify package name and bug fixed.

v1.0.2 2017.02.17 Add exception callback.

v1.0.1 2017.02.15 Bug fixed.

v1.0.0 2017.02.10 Release v1.

License

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