三星GALAXY指纹识别Pass SDK(一)

简述

Pass SDK是三星为GALAXY系列Android应用开放的指纹识别开发包。

Pass SDK使用条件:

  • Android 4.2(API 17)及以上
  • 设备有指纹识别传感器


Pass SDK提供以下功能:

  • 请求指纹识别。可使用默认或自定义的界面进行指纹识别,Pass SDK也提供无界面的指纹识别
  • 取消指纹识别请求。当发起指纹识别请求后20秒无指纹输入,请求将自动取消。APP也可直接取消
  • 验证当前用户的指纹是否与设备的注册的指纹匹配
  • 通过指纹按键注册指纹
  • 从已注册指纹序列中,获取被识别指纹的索引
  • 获取已注册指纹的备注、唯一ID或索引
  • 指定某次识别请求中指纹的索引
  • 为识别对话框添加标题
  • 为识别对话框添加logo
  • 设置识别对话框之外元素的透明度
  • 设置点击识别对话框之外,对话框是否消失
  • 当注册的指纹改变时,发出广播。如添加或删除指纹时,系统将发出广播
  • 为识别对话框设置按钮
  • 自定义识别对话框对话框内容

Figure 2: UI with the password button (left) and without the password button (right)

Hello Pass

添加权限

<uses-permission android:name= "com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY"/> 

Android 4.4.2及以上必须添加此权限,否则抛出SecurityException。4.4.2以前的系统APP可正常运行

示例代码

  1. 初始化Spass类
  2. 发起指纹识别请求
  3. 接收来自IdentifyListener的事件

public class HelloPass extends Activity { 
 
    private SpassFingerprint mSpassFingerprint; 
    private Context mContext; 
 
    private SpassFingerprint.IdentifyListener listener =  
    new SpassFingerprint.IdentifyListener() { 
 
        @Override 
        public void onFinished(int eventStatus) { 
            // It is called when fingerprint identification is finished. 
            if (eventStatus == SpassFingerprint.STATUS_AUTHENTIFICATION_SUCCESS) { 
                // Identify operation succeeded with fingerprint  
                 
            } else if (eventStatus == SpassFingerprint. 
STATUS_AUTHENTIFICATION_PASSWORD_SUCCESS) { 
                // Identify operation succeeded with alternative password 
                            }  
              else { 
               // Identify operation failed with given eventStatus.  
               // STATUS_TIMEOUT_FAILED 
               // STATUS_USER_CANCELLED  
               // STATUS_AUTHENTIFICATION_FAILED 
               // STATUS_QUALITY_FAILED 
               // STATUS_USER_CANCELLED_BY_TOUCH_OUTSIDE 
               // STATUS_BUTTON_PRESSED 
               // STATUS_OPERATION_DENIED 





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值