Android m finger print(public)

Preview:

Citation preview

Android MFingerprint API

@nory_kaname

自己紹介

● 組み込みエンジニア

● 携帯電話開発(9年)○ ガラケー○ スマートフォン

● Android Developer(5年)○ 組み込み支援○ Frameworkカスタマイズ○ アプリケーション開発

● クックビズ株式会社所属

執筆

プロの力が身につく Androidプログラミングの教科書

こんなアプリを作ってます

エンジニア募集中

iOS / Androidエンジニア、待ってます!!

本編

Fingerprint AuthenticationConfirm CredentialApp LinkingAuto Backup for AppsDirect ShareVoice InteractionsAssist APIAdoptable StorageNotificationsBluetooth Stylus SupportImproved Bluetooth Low Energy Scanning

Hotspot 2.0 Release 1 Support4K Display ModeThemeable ColorStateListsAudio FeaturesVideo FeaturesCamera FeaturesAndroid for Work Features

Android M APIs

Fingerprint AuthenticationConfirm CredentialApp LinkingAuto Backup for AppsDirect ShareVoice InteractionsAssist APIAdoptable StorageNotificationsBluetooth Stylus SupportImproved Bluetooth Low Energy Scanning

Hotspot 2.0 Release 1 Support4K Display ModeThemeable ColorStateListsAudio FeaturesVideo FeaturesCamera FeaturesAndroid for Work Features

Android M APIs

FingerPrint

指紋認証機能

・キーガード解除

・アプリでの指紋認証ログイン

・アプリ/サーバー間の認証

アプリケーションでの使用ケース

指紋認証機能

・キーガード解除

・アプリでの指紋認証ログイン

・アプリ/サーバー間の認証

Permission

Android ManifestのPermission記載

<uses-permission android:name="android.permission.USE_FINGERPRINT"/>

<uses-permission android:name="android.permission.USE_FINGERPRINT" android:required="false"/>

指紋認証機能のPermission宣言

必須 or オプション

API

FingerprintManagerクラス

モジュール

authenticate 認証開始

hasEnrolledFingerprints 指紋が登録されているか

isHardwareDetected 指紋認証ハードウェアが搭載しているか

mFingerprintManager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);

指紋認証機能のチェック

指紋認証する前に、ハードウェアと指紋の登録状況を確認

public boolean isFingerprintAuthAvailable() {return mFingerprintManager.isHardwareDetected()

&& mFingerprintManager.hasEnrolledFingerprints();}

FingerPrint APIs

指紋認証の実行

mFingerprintManager.authenticate(cryptoObject, mCancellationSignal, 0 /* flags */, mAuthenticationCallback, null);

認証結果:AuthenticationCallackprivate FingerprintManager.AuthenticationCallback mAuthenticationCallback = new FingerprintManager.AuthenticationCallback(){ @Override public void onAuthenticationError(int errorCode, CharSequence errString) { // 認証エラー

super.onAuthenticationError(errorCode, errString); }

@Override public void onAuthenticationHelp(int helpCode, CharSequence helpString) { // 認証時のヘルプ文言

super.onAuthenticationHelp(helpCode, helpString); }

@Override public void onAuthenticationSucceeded(FingerprintManager.AuthenticationResult result) { // 認証成功

super.onAuthenticationSucceeded(result); }

@Override public void onAuthenticationFailed() { // 認証失敗

super.onAuthenticationFailed(); }};

Android Frameworks内では

Android Frameworks

● アプリケーションから使用する場合○ Context#getSystemService()でFragmentprintManagerにアクセス

○ コールバックで結果を受け取る

Android Frameworks

FingerprintManagerの責務

● FingerprintManagerクラス○ アプリケーションから要求を受け取る○ Android Frameworksのサービス群にある、FingerprintServiceに連携○ 認証結果をFingerprintServiceから受け取り、アプリケーションに通知する

FingerprintServiceの責務

● FingerprintServiceクラス○ SystemServiceクラスを継承○ Android Systemとして指紋認証機能を実行○ Native(JNI->HAL)につなぐ○ 認証要求時にFingerprintDeamonクラスをとおして、Native層に通知○ アプリケーションの突然死の際、unbindする(IBinder.DeathRecipient)

JNI / HAL層

● JNI / HAL層○ HAL層(ライブラリ)をとおして、Kernelに通知、ハードウェアの制御を行う○ 認証結果をKeystoreServiceに通知

ご静聴、ありがとうございました。

Recommended