Coder Social home page Coder Social logo

fingerprintidentify's Introduction

FingerprintIdentify

Android指纹识别API兼容库,目前整合了安卓原生API以及三星和魅族的指纹SDK,支持继续拓展。

API调用优先级:安卓原生 > 三星SDK > 魅族SDK

Usage

1. 添加引用

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

2. 添加指纹识别权限

<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方法解释

mFingerprintIdentify = new FingerprintIdentify(this);                       // 构造对象
mFingerprintIdentify = new FingerprintIdentify(this, exceptionListener);    // 构造对象,并监听错误回调
mFingerprintIdentify.isFingerprintEnable();                                 // 指纹硬件可用并已经录入指纹
mFingerprintIdentify.isHardwareEnable();                                    // 指纹硬件是否可用
mFingerprintIdentify.isRegisteredFingerprint();                             // 是否已经录入指纹
mFingerprintIdentify.startIdentify(maxTimes, listener);                     // 开始验证指纹识别
mFingerprintIdentify.cancelIdentify();                                      // 关闭指纹识别
mFingerprintIdentify.resumeIdentify();                                      // 恢复指纹识别并保证错误次数不变

4. startIdentify方法解析

mFingerprintIdentify.startIdentify(3, new BaseFingerprint.FingerprintIdentifyListener() {
    @Override
    public void onSucceed() {
        // 验证成功,自动结束指纹识别
    }

    @Override
    public void onNotMatch(int availableTimes) {
        // 指纹不匹配,并返回可用剩余次数并自动继续验证
    }

    @Override
    public void onFailed() {
        // 错误次数达到上限或者API报错停止了验证,自动结束指纹识别
    }
});

5. 混淆设置

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

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

6. 其他说明

compile 'com.android.support:appcompat-v7:23.4.0'

这里如果使用25.X版本的兼容库,可能会导致部分即使是6.0系统的机型也不能正常使用指纹识别,具体请客参考:

https://code.google.com/p/android/issues/detail?id=231939

7. 更新历史

v1.1.1 2017.03.20 AppCompat支持库从25.2.0降级到23.4.0,因为第6点问题还没修复

v1.1.0 2017.03.16 调整包名,修正魅族指纹SDK的API调用问题

v1.0.2 2017.02.17 新增异常回调接口

v1.0.1 2017.02.15 修正三星指纹API调用(开始识别和关闭指纹都必须在主线程调用)

v1.0.0 2017.02.10 发布第一版本

License

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

fingerprintidentify's People

Contributors

uccmawei avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.