注册指纹Enrolling a Fingerprint
02/16/2018
本文内容
注册指纹概述Enrolling a Fingerprint Overview
只有当设备已配置有指纹身份验证时,Android 应用程序才能使用指纹身份验证。It is only possible for an Android application to leverage fingerprint authentication if the device has already been configured with fingerprint authentication. 本指南将介绍如何在 Android 设备或模拟器上注册指纹。This guide will discuss how to enroll a fingerprint on an Android device or Emulator. 模拟器没有实际硬件来执行指纹扫描,但可以借助 Android Debug Bridge 来模拟指纹扫描(如下所述)。Emulators do not have the actual hardware to perform a fingerprint scan, but it is possible to simulate a fingerprint scan with the help of the Android Debug Bridge (described below). 本指南将介绍如何在 Android 设备上启用锁屏界面,并注册指纹身份验证。This guide will discuss how to enable screen lock on an Android device and enroll a fingerprint for authentication.
要求Requirements
若要注册指纹,必须有运行 API 级别 23 (Android 6.0) 的 Android 设备或模拟器。To enroll a fingerprint, you must have an Android device or an emulator running API level 23 (Android 6.0).
若要使用 Android Debug Bridge (ADB),需要熟悉命令提示符,且 adb 可执行文件必须位于 Bash、PowerShell 或命令提示符环境的 PATH 中。The use of the Android Debug Bridge (ADB) requires familiarity with the command prompt, and the adb executable must be in the PATH of your Bash, PowerShell, or Command Prompt environment.
配置锁屏界面并注册指纹Configuring a Screen Lock and Enrolling a Fingerprint
若要设置锁屏界面,请按照以下步骤操作:To setup a screen lock, perform the following steps:
依次转到“设置”>“安全” ,然后选择“锁屏界面” :Go to Settings > Security, and select Screen lock:
在随即出现的下一个屏幕上,可以选择和配置一种锁屏界面安全方法:The next screen that appears will allow you select and configure one of the screen lock security methods:
选择并完成一种可用的锁屏界面方法。Select and complete one of the available screen lock methods.
配置锁屏界面后,依次返回到“设置”>“安全” 页,然后选择“指纹” :Once the screenlock is configured, return to the Settings > Security page and select Fingerprint:
然后,按照以下顺序向设备添加指纹:From there, follow the sequence to add a fingerprint to the device:
在最后一个屏幕中,系统会提示你将手指放在指纹扫描程序上:In the final screen you are prompted to place your finger on the fingerprint scanner:
如果使用的是 Android 设备,请用手指触摸扫描程序来完成此过程。If you are using an Android device, complete the process by touching a finger to the scanner.
在模拟器上模拟指纹扫描Simulating a Fingerprint Scan on the Emulator
在 Android 模拟器上,可以使用 Android Debug Bridge 来模拟指纹扫描。On an Android emulator, it is possible to simulate a fingerprint scan by using the Android Debug Bridge. 在 OS X 上,启动终端会话,而在 Windows 上,则启动命令提示符或 Powershell 会话,并运行 adb:On OS X start a Terminal session while on Windows start a command prompt or a Powershell session and run adb:
$ adb -e emu finger touch 1
值 1 是“已扫描”的手指的 finger_id 。The value of 1 is the finger_id for the finger that was "scanned". 它是为每个虚拟指纹分配的唯一整数。It is a unique integer that you assign for each virtual fingerprint. 以后,当应用运行时,只要模拟器提示你输入指纹,就可以运行这个相同的 ADB 命令。可以运行 adb 命令,并向它传递 finger_id ,以模拟指纹扫描。In the future when the app is running you can run this same ADB command each time the emulator prompts you for a fingerprint, you can run the adb command and pass it the finger_id to simulate the fingerprint scan.
在指纹扫描完成后,Android 会通知你指纹已添加:After the fingerprint scan is complete, Android will notify you that the fingerprint has been added:
总结Summary
本指南介绍了如何在 Android 设备或 Android 模拟器中设置锁屏界面并注册指纹。This guide covered how to setup a screen lock and enroll a fingerprint on an Android device or in an Android emulator.