fingerprint


fingerprint는 3.0.0 버전 이상 부터 제공되며 해당 라이브러리를 추가하여 사용해야 된다.

fingerprint 은 HSP 에서 확장 라이브러리로 제공하는 API 로 aar 라이브러리 파일과 build.gradle 파일을 수정하여 사용할 수 있다. 

라이브러리 추가 방법은 Android 개발 가이드의 내용을 참조하면 된다.

fingerprint 은 지문이 올바른지 유/무 를 전달하는 기능을 가지고 있으며 Optional 한 기능이므로 사용자가 별도로 개발하여 사용해도 무방하다.


authenticate

authenticate 를 요청 하면 먼저 단말에 지문이 등록되어 있는지를 확인한 뒤 지문이 등록되어 있으면 센서에 인식중인 지문이 올바른지 그렇지 않은지를 반환 한다. 

options

필드설명M/O
message지문인증 다이얼로그에 출력할 메시지M
   

Example

DAPFingerprint.authenticate(this@MainActivity, "지문인식을 해주세요", {
   //TODO
}) {
   //TODO
}
DAPFingerprint.authenticate(MainActivity.this, "지문인식을 해주세요", result -> {
       // TODO
   }, e -> {
       // TODO
   });

기본 Layout

API LEVEL 28 부터는 Android 제공하는 Biotmetric Prompt 를 이용하여 생체 인증을 검증하기 때문에 레이아웃을 커스텀 할 수 없다. 

지문 인식시 화면에 나타나는 다이얼로그는 hone_fingerprint_dialog.xml 으로 구성되어 있으며 App 단에서 해당 xml 을 새로 만들어 버튼과 이미지 등을 변경할 수 있다. 

hone_fingerprint_dialog.xml


<RelativeLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:orientation="vertical">

   <ImageView
       android:id="@+id/fingerprint_icon"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:src="@drawable/hone_fingerprint_ic_fp_40px"
       android:layout_centerHorizontal="true"
       tools:ignore="ContentDescription"/>

   <ImageView
       android:id="@+id/result"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_below="@+id/fingerprint_icon"
       android:layout_toRightOf="@+id/fingerprint_icon"
       android:translationX="-20dp"
       android:translationY="-20dp"
       android:src="@drawable/hone_fingerprint_ic_fingerprint_success"
       android:visibility="gone"
       tools:ignore="ContentDescription,RtlHardcoded"/>

   <TextView
       android:layout_marginTop="20dp"
       android:id="@+id/retry_message"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_below="@+id/fingerprint_icon"
       android:layout_centerHorizontal="true"
       android:textSize="20sp"
       android:textStyle="bold"
       android:text="@string/hone_fingerprint_retry"
       android:visibility="gone"
       />

   <TextView
       android:layout_marginTop="20dp"
       android:layout_marginLeft="20dp"
       android:layout_marginRight="20dp"
       android:id="@+id/message"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_below="@+id/retry_message"
       android:gravity="center"
       android:layout_centerHorizontal="true"
       />

   <Button
       android:id="@+id/cancel_button"
       style="?android:attr/buttonBarButtonStyle"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginTop="20dp"
       android:layout_gravity="center"
       android:text="@android:string/cancel"
       android:layout_below="@+id/message" android:layout_alignParentLeft="true"
       android:layout_alignParentStart="true"/>
</RelativeLayout>

Error Code

CodeCauseComment
E11800파라메터 값이 잘못되어 있을 경우 
E11801전달된 액션 값이 알 수 없는 액션일 경우 
E11802지문인증 다이얼로그에 출력할 메시지가 null 이거나 빈값인 경우 
E11850실행 중 오류가 발생 되었을 경우 
E11851단말이 지문 인증을 지원하지 않을 때 
E11852단말에 지문을 등록하지 않았을 때 
E11853단말에 지문 인증을 계속 실패 하였을 때 
E11854사용자가 지문 인증을 취소한 경우 
E11899알 수 없는 오류가 발생 되었을 경우