4

I am trying to enroll fingerprint to android emulator with adb command line.

I know I can set PIN with this command:

adb shell locksettings set-pin 1111

I can enter security settings with this:

adb shell am start -a android.settings.SECURITY_SETTINGS

I can touch fingerprint to sensor with:

adb -e emu finger touch 1

But is there way how to enroll fingerprint? Thank You!!

Pavol
  • 552
  • 8
  • 19
  • This answer explains how to enroll a fingerprint in the Android Emulator: https://stackoverflow.com/questions/35335892/android-m-fingerprint-scanner-on-android-emulator – Michael Dougan May 14 '19 at 15:46
  • 2
    @MichaelDougan from comments: "So go in Settings -> Security -> Fingerprint -> Add fingerprint" ... I want to do this just with command line .. I don't want to do it manually. That is the point of my question. – Pavol May 15 '19 at 06:00
  • @Pavol did you find a way to do this? – Jon Feb 08 '20 at 21:25
  • @Jon nope.. currently I open settings page with command above and then I use Xamarin.UITest with Tap commands. – Pavol Feb 10 '20 at 13:45

1 Answers1

2

Here are my steps to enroll a fingerprint on the emulator by only using adb command (tested on a x86_64, Google API 28 emulator):

  • Set the lock screen passcode to be 1111
$ adb shell locksettings set-pin 1111
  • Start the Settings app
$ adb shell am start -a android.settings.SECURITY_SETTINGS
  • Tap the Fingerprint item
$ adb shell input tap 274 1469
  • Tap the Next button on the confirm screen
$ adb shell input tap 914 1704

NOTE: the tap's coordinate was getting on the same emulator by enabling the Show Touch Location under the Developer Options setting.

  • Enter the passcode in the confirmation screen
$ adb shell input text 1111 && adb shell input keyevent 66
  • Execute the following command for at least 3 times to finish the fingerprint enrollment
$ adb -e emu finger touch 1
  • Finally, close the screen
$ adb shell input tap 914 1704

Updated: To find the location for the click/tap action (e.g. 914 1704) enable the Pointer location in the Developer Option as attached image

pddthinh
  • 141
  • 6
  • how are you able to know that `914 1704` is the designated for Done/Close buttons? Do you have a reference link for me to check? – Zerosero Oct 28 '22 at 04:32
  • it looks like it's actually the location of the setting. Correct me if I'm wrong – Zerosero Oct 28 '22 at 04:40
  • yes, you are correct, those are the of the clicking point. You can find them easily in the Developer option --> enable Pointer location then when ever you click/move the mouse, the location is shown on the top of the screen. – pddthinh Nov 02 '22 at 15:12