yunos运行linux程序,YunOS开放平台
一、指纹SDK介绍:
阿里指纹2.0框架提供了指纹SDK,供第三方应用使用指纹识别功能。采用指纹2.0框架的终端设备上,第三方应用开发者可以使用指纹SDK开发自己的基于指纹识别的功能。
指纹SDK提供的功能包括:
1、查询当前设备是否支持指纹功能
2、向应用程序提供注册监听指纹事件的接口和注册事件处理回调函数
3、指纹事件发生时,通知应用程序,执行注册的事件处理回调函数
4、向应用程序提供注销监听指纹事件的接口
这里的指纹事件包括:
等待手指按压
探测到手指
读取指纹图像完成
提取指纹特征完成
指纹验证完成
手指已经离开
二、指纹SDK使用方法:
1、将jar包加入代码工程(eclipse工程为例)
l将alifp2sdk.jar包拷贝到工程的libs目录下
l配置编译路径:
”Build Patch“——>”Config build patch”——>“java build path”——>”libraries”
——>“Add JARs”——>选中alifp2sdk.jar包——>”OK”
2、代码中引用jiar提供的接口:
a)Import接口类
import com.yunos.alifinger.fingerPrintCommunication;
b)判断移动设备是否支持阿里指纹2.0框架
Boolean mIsSupport =fingerPrintCommunication.isSupportAliFinger(mContext);
c)定义事件处理回调函数,创建接口类实例
fingerPrintCommunication mFPComm;
mFPComm = new fingerPrintCommunication(this, new fingerPrintCommunication.fpListener() {
@Override
public voidonCatchedEvent(intevent,intresult) {
//handler fingerprint event
Switch() {
case fingerPrintCommunication.FP_EVENT_DETECTED:
//探测到手指
break;
case fingerPrintCommunication.FP_EVENT_VERIFY:
if(result == 0) {
//验证成功
} else {
//验证失败
}
break;
case fingerPrintCommunication.FP_EVENT_GOT_VERIFIED_FEATURE:
//提取指纹特征完成
break;
case fingerPrintCommunication.FP_EVENT_GOT_IMAGE_FAIL:
//读取指纹图像失败
break;
case fingerPrintCommunication.FP_EVENT_WAITING_INPUT:
//等待手指按压
break;
case fingerPrintCommunication.FP_EVENT_FINGER_LEFT:
//手指已经离开
break;
}
}
});
d)注册监听指纹事件
应用程序切换到前台时,注册监听需要的指纹事件。建议在onResume中完成
if(mFPComm!=null&&mIsSupport){
mFPComm.registerFpListener(
fingerPrintCommunication.FP_EVENT_DETECTED
| fingerPrintCommunication.FP_EVENT_VERIFY);
}
e)注销监听指纹事件
应用程序被切换到后台时,注销监听指纹事件。建议在onPause中完成
if (mFPComm != null) {
mFPComm.unregisterFpListener();
}
三、申请方式
指纹SDK正在内测中,如有需要使用,请发邮件至 yunos-open(at)service.alibaba.com 申请。