How can I emulate fingerprint on real device for tests? - adb

I can emulate finger print in Android emulator with this command:
adb -e emu finger touch 1
But how can I emulte it when I wanna add fingerprint on real device fo qa automation?

Related

adb server always restarts: adb server version (40) doesn't match this client (41)

I can't debug the application to the emulator because adb is unstable as shown in the log below, I tried to do the adb device command three times but the results are different, how do I fix it?
$ adb devices
List of devices attached
emulator-5554 device
$ adb devices
adb server version (40) doesn't match this client (41); killing...
daemon started successfully
List of devices attached
emulator-5554 offline
$ adb devices
List of devices attached
emulator-5554 device

what is the key_code to enable or disable wifi via adb for non rooted device

I have a non rooted Samsung device , i want to enable/disable wi-fi settings for my usages via adb.To open wifi for non rooted device via adb i ran below command
adb -s 4d0075754fdb41cd shell am start -n com.android.settings/.wifi.WifiSettings
By default the wifi is coming as diabled , i want to enable/disable it
I tried with Keyevent , however this did not helped much
adb shell input keyevent 22
The wi-fi slider looks like below , i tried with all available key_code .
Can anyone point me a way to get the correct keycode here!!
You can try adb -s $PHONESERIAL shell "svc wifi enable" if you just want to turn on the wifi with adb.
Was already answered here : android adb turn on wifi via adb
You placed appium tag, so if you using appium, try running:
adb -s $device_id shell am broadcast -a io.appium.settings.wifi --es setstatus enable
adb -s $device_id shell am broadcast -a io.appium.settings.wifi --es setstatus disable

Android Things: take a screenshot

How do you take a screenshot via ADB for Android Things? I have tried:
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
adb shell rm /sdcard/screen.png
and
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png
I couldn't make screepcap work in Android Things Developer Preview. The command results in a 0-size file.
That said, I recommend the following two options: either use the framebuffer or record a video (screenrecord seems to work) and convert it to an image later on by proper tool. I'll consider the first option, so the steps would be:
Pull the framebuffer to the host machine. Note that you need to start adbd as root in order to pass a permission check:
adb root
adb pull /dev/graphics/fb0 screenshot
Convert the raw binary to image by the tool you prefer. I'm using ffmpeg. The command below might not work for you due to different screen resolution or pixel format. If so, make proper changes.
ffmpeg -f rawvideo -pix_fmt rgb565 -s 800x480 -i screenshot screenshot.png
Seems, because of old limited OpenGL version in Android Things, described by Tatsuhiko Arai here there is no possibility to get screenshot via ADB, but You can record video (e.g. from Android Studio, or via ADB commands) and than grab frame from it, for example via ffmpeg:
ffmpeg -i device-2017-01-23-193539.mp4 -r 1 screen-%04d.png
where device-2017-01-23-193539.mp4 - name of recorded (via Android Studio) file .
I've tried exactly this code with a little bit change like below (but no matter) and it works well. The image is in my platform-tools directory now.
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png screen.png
adb shell rm /sdcard/screen.png

how to update adb drivers for android phones?

I am having difficulties in my android application because i want to run my project in my android device. I tried to install some drivers for my phone but still, it can't update the drivers and my phone is not recognized even in adb devices. Please help. Thanks.
Run android update adb
Run adb kill-server
Run adb start-server
At this point, calling adb devices started returning devices again.
Now run or debug your project to test it on your device.
If you use Windows
If you don't have the android and adb set as windows environment variables, just go to
C:\Program Files\Android\sdk\platform-tools
(in explorer press Shift+RightClick in the white part and open command window) and use the following commands: ..\tools\android.bat update adb adb kill-server adb start-server
For android phones,
Turn on Developer mode on settings
For Oculus devices,
Open Oculus App in your android/ios device
Make sure the oculus device is connected via bluetooth
Goto Settings, Click on oculus device name
From Dropdown menu, click More Settings -> Developer Mode and turn it on
I was able to find ADB required version 1.0.40 from here and it works like a charm:
D:\Setups\XXXXX\Lineage FP3\platform-tools_28.0.1(ADB_1.0.40)>adb devices
List of devices attached
A2XXXXXXXXX1 unauthorized

Bat to run Android_Server from cmd & extra window for port forwarding

2 Questions, first is most important. 2nd is an issue that im stumped on.
First is a script for Android_Server
second is Android_Server version vs IDA compatibility.
First Question:
my goal is to run a bat file to push android_server to 1 device connected to usb or using wifi adb server on device, then run some commands in adb & dos cmd line while keeping this window open to run the Android_server for IDA. A second window needs to opened! closed after it forwards port. adb forward tcp:23946 tcp:23946 (this is the forwardport.bat)
#echo off
adb kill-server
echo [*] Pushing Android Server To Device...
adb push Android_Server /data/local/tmp/
adb shell chmod 755 /data/local/tmp/android_server
echo [*]
echo [*] Adding Super User... For Android_Server
adb shell
su
echo [*]
echo [*] Now Starting (Debug Server)...
adb /data/local/tmp/./android_server
start cmd.exe forwardport.bat
Pause
my issues are that it dont pause long enough when doing adb shell then su, it starts the server then trys to su, im stuck here so my script fails as im using cmd line & not used to sharing adb & cmd line commands together. what ever creative way this can be made would be awesome.
Second Question:
I know Android_Server is 32bit. using IDA 6.5 64bit I have android_server 1.14 & 1.17
I can only get android_Server 1.14 to work on IDA 6.5 32bit.
If I try to use IDA 6.5 64bit it wont allow me to load either 1.14 or 1.17 so I cant use IDA 6.5 64bit to debug arm processes at all.
Using IDA 64bit: v1.14 does a popup window in IDA says: Warning Incompatible debugging server: protocol version is 14, expected 17
This is what it says when using IDA 64bit switching to v1.17: says nothing on IDA only android_server cmd line window says:
IDA Android 32-bit remote debug server v1.17. Hex-Rays 2004-2013
Listening on port #23946...
Accepting connection from 192.168.0.27
Incompatible IDA version
Closing connection from 192.168.0.27
my goal is to only use IDA 64bit not 32bit. trying to figure out if its the android_server or Android NDK wrong version installed. as I have the full android SDK installed over 20gb Android 1.5-5.0, but only android-ndk-r10b do I need other versions of NDK?
Thanks for any help with either question.

Resources