Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
AndroidX Biometric Library
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
syarihu
October 31, 2018
Technology
14k
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AndroidX Biometric Library
shibuya.apk #29で発表したAndroidXの生体認証の話です。
syarihu
October 31, 2018
More Decks by syarihu
See All by syarihu
[DroidKaigi 2026] Making UI specifications visible: Android UI development in the AI agent era supported by Compose Screenshot Testing and galleries
syarihu
0
630
Recap #io25 What's new in Google Play
syarihu
0
150
[DroidKaigi 2024] Android ViewからJetpack Composeへ 〜Jetpack Compose移行のすゝめ〜 / From Android View to Jetpack Compose: A Guide to Migration
syarihu
4
5.3k
[shibuya.apk #46] Composableの枠を超えてアニメーションする / Animation beyond Composable
syarihu
0
150
[shibuya.apk #41] Jetpack Composeでグリッドに柔軟にスペースを入れたい
syarihu
0
3.6k
[DroidKaigi 2022] 詳解Google Playの新しい定期購入 ~オファーの活用や実装例を添えて~
syarihu
0
4k
5分で分かるGoogle Playの新しいサブスクリプション / Google Play new subscription 2022
syarihu
1
2k
[DroidKaigi 2021] Google Play 定期購入 比例配分モード完全攻略ガイド / Google Play Subscription Proration Mode Complete Guide
syarihu
1
8.2k
[Money Forward Tech Drive] What's new in Google Play [Recap #io21]
syarihu
0
660
Other Decks in Technology
See All in Technology
コーディングエージェントでM5Stack系の開発を少し試した時の話 / M5 Japan Tour 2026 Autumn 東京
you
PRO
0
180
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
280
AIエージェントの自己改善をどう設計するか / How to Design Self-Improvement for AI Agents
22mi
3
2.1k
Claude Code本って、 読む必要あるの?
oikon48
2
420
安心して変更できるWebフロントエンドの作り方
pirosikick
4
1.4k
AI時代、データエンジニアが一番おもろい
genshun9
0
180
生成AIのテナント制御とシャドーMCP対策 | AIを"止めずに"、情報を守る
yukun
0
160
2026/09/10 Spring Bootから Jakarta EE/MicroProfileへの移行
megascus
0
340
OpenTelemetryのメトリクスをCloudWatchに送ってPromQLで見てみた
ota1022
0
120
20260912_スクフェス三河
kgnkhkr
0
300
Where Is JetBrains AI Heading- — Central CLI, Air Alpha, and the Agentic Development Stack
x5gtrn
PRO
0
160
omasushiというライブラリを作った
polidog
PRO
0
210
Featured
See All Featured
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
320
[RailsConf 2023] Rails as a piece of cake
palkan
59
7k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
Are puppies a ranking factor?
jonoalderson
2
3.9k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Embracing the Ebb and Flow
colly
88
5.2k
Building Applications with DynamoDB
mza
96
7.2k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
250
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
The agentic SEO stack - context over prompts
schlessera
0
920
sira's awesome portfolio website redesign presentation
elsirapls
0
410
Transcript
AndroidX Biometric Library shibuya.apk #29 2018/10/31 (Wed) @syarihu
Taichi Sato (@syarihu) • Money Forward, Inc. ◦ Android Engineer
• TechBooster
None
Fingerprint API
• Android 6.0 (API Level 23)から利用 できる公式の指紋認証API • FingerprintManagerクラスを利用して実 装する
Fingerprint API
• Android 6.0 (API Level 23)から利用 できる公式の指紋認証API • FingerprintManagerクラスを利用して実 装する
• Android 9.0 (API Level 28)から非推奨 Fingerprint API
BiometricPrompt API
• Android 9.0 (API Level 28)から利用 できるAPI • より強力な生体認証を提供する •
BiometricPromptクラスを利用して 実装する BiometricPrompt API
• 生体認証を行うためのダイアログを提供 する • 認証ダイアログが内部で実装されている ため、画面の一部に生体認証を入れる ことはできない BiometricPrompt API
None
AndroidX Biometric Library
• 非推奨になったFingerprint APIと 新しいBiometricPrompt APIの互換性を 保って利用するためのライブラリ ◦ 2018年10月現在の最新バージョンは 1.0.0-alpha2 Android
X Biometric Library
• 非推奨になったFingerprint APIと 新しいBiometricPrompt APIの互換性を 保って利用するためのライブラリ ◦ 2018年10月現在の最新バージョンは 1.0.0-alpha2 •
androidx.biometric.BiometricPrompt Android X Biometric Library
• BiometricFragment • FingerprintHelperFragment • FingerprintDialogFragment Android X Biometric Library
• BiometricFragment ◦ Android 9.0以上のPlatformの BiometricPromptクラスを利用 Android X Biometric Library
• FingerprintHelperFragment ◦ Android 6.0以上の FingerprintManagerクラスを利用 • FingerprintDialogFragment ◦ FingerprintHelperFragmentを内部で
呼び出してダイアログを表示 Android X Biometric Library
Android X Biometric Library • これらのFragmentはAndroidX ライブラリ内部からの呼び出しに制限さ れている
Android X Biometric Library • これらのFragmentはAndroidX ライブラリ内部からの呼び出しに制限さ れている • AndroidXのBiometricPromptクラスの
authenticateメソッド内部でAPI Levelに よって処理を分けている
Android X Biometric Library • パーミッション ◦ android.permission.USE_FINGERPRINT ◦ android.permission.USE_BIOMETRIC
• AndroidManifest.xmlにあらかじめ追加 されているため、自分で追加する必要は ない
Android X Biometric Library を使ってみる
build.gradle dependencies { implementation 'androidx.biometric:biometric:1.0.0-alpha02' }
ダイアログの設定 val builder = BiometricPrompt.PromptInfo.Builder().apply { setTitle("生体認証を行います") setSubtitle("サブタイトル") setDescription("説明") setNegativeButtonText("キャンセル")
}
コールバックの実装 val callback = object : BiometricPrompt.AuthenticationCallback() { override fun
onAuthenticationSucceeded( result: BiometricPrompt.AuthenticationResult ) { super.onAuthenticationSucceeded(result) /** 成功処理 */ }
コールバックの実装 override fun onAuthenticationFailed() { super.onAuthenticationFailed() /** 失敗処理 */ }
コールバックの実装 override fun onAuthenticationError(errorCode: Int, errString: CharSequence) { /** エラー処理
*/ when (errorCode) { BiometricConstants.ERROR_NO_BIOMETRICS -> { // 生体認証未登録 } else -> { // それ以外 } } }
Executorの実装 private fun mainExecutorCompat(): Executor { return if (Build.VERSION.SDK_INT >=
28) { mainExecutor } else { HandlerExecutor(Handler(mainLooper)) } }
Executorの実装 private class HandlerExecutor( private val handler: Handler ) :
Executor { override fun execute(runnable: Runnable) { handler.post(runnable) } }
getMainExecutorメソッド • API Level 28以上のContextに実装されて おり、それ未満のAPI Levelでは使えない
getMainExecutorメソッド • AndroidXの開発中のソースコードには ContextCompatにgetMainExecutor メソッドがある • AndroidXの次のバージョンにこれが含まれれ ば、今後自前で実装する必要は無くなる
生体認証を開始する BiometricPrompt( this /** FragmentActivity */, mainExecutorCompat(), callback ).authenticate(builder.build())
Android 8.0
Android 9.0
• Fingerprint APIはAPI Level 28で 非推奨になるため、BiometricPromptを 使う必要がある • AndroidXのBiometricライブラリを 使えば簡単に実装可能
まとめ
• ContextCompatにgetMainExecutor メソッドが実装されれば自前でExecutor を実装する必要がなくなる ので気にしておくとよい まとめ
Trick or Treat (技術書典5新刊) • Android Xの生体認証の話 • AACのViewModelをDagger で生成する話
• 機械学習の型の話 • Androidネイティブ ライブラリビルドTips https://techbooster.booth.pm/items/1046485
ありがとうございました