Is there a way in adb to wait for a device with a particular name/id
I tried following so far
$adb wait-for-device emulator-5554
$adb wait-for-device -e emulator-5554
$adb wait-for-device - s shell emulator-5554```
but did not work
This should work
$ adb -s emulator-5554 wait-for-any-device
Related
Can you help me please, my head is swollen...
I am trying to run daemon on android emu/device by command:
adb -s <device_name> shell su -c /dir/daemon <port_number>
but nothink happens, and no errors!
If I do:
adb -s <device> shell
and then form shell cmdline:
su -c /dir/daemon <port_number>
than its work fine. I try use shell-script and run:
adb -s <device_name> shell sh su -c /dir/script.sh <port_number>
and I even try to generate script from Qt code with port number and use:
adb -s <device_name> shell sh su -c /dir/script.sh
but its not helped... problem that if I enter to adb shell previous to run daemon - its work. Another problem is on different device/emu/iso_image different command format could not work. For example:
adb -s <device_name> shell su -c /dir/daemon <port_number> // work at emu, but not at iso
and vice:
adb -s <device_name> shell su -c "/dir/daemon <port_number>" // work at iso
etc.
Everybody can answer what's the matter?
Sorry for my english
adb shell su -c "/dir > /dev/null 2> /dev/null < /dev/null &"
or
shell su -c /data/local/tmp/start_daemon.sh
#!/system/bin/sh
/data/local/tmp/nohup
/data/local/tmp/daemon <portn_number> &
I write a alias command for get version of android in PC using adb shell, like this:
alias av="echo v:`adb shell getprop ro.build.version.release`;
echo sdk:`adb shell getprop ro.build.version.sdk`;
echo model:`adb shell getprop ro.product.model`;
echo display:`adb shell getprop ro.build.display.id`;"
I connect one device, it right outputs :
v:4.0.4
sdk:15
model:ZTE N983
display:N983V1.0.0B06
But when I change another device. It also output last text. When i open new shell, it output rights again. Why?
Alias has a cache? How to solve it ?
Thanks.
Backticks are evaluated immediately.
Use something like
alias av="echo -n v; adb shell getprop ro.build.version.release; ..."
to make the adb commands be executed at the time of alias execution.
The final result
1 alias av="echo -n v:; adb shell getprop ro.build.version.release; echo -n sdk:;adb shell getprop ro.build.version.sdk; \
echo -n model:;adb shell getprop ro.product.model; echo -n display:;adb shell getprop ro.build.display.id";
2 alias av='echo v: adb shell getprop ro.build.version.release; echo sdk: adb shell getprop ro.build.version.sdk; echo model: adb shell getprop ro.product.model; echo display: adb shell getprop ro.build.display.id'
But The second way cannot begin a new line using \
I can't get the logcat to clear out it worked when i had just one device running but when i have two it doesn't work. I'm running the script every 5 mins and want the log to be cleared so the log file created is for that particular test run each time.
logcat -c is the command to clear it but it doesn't seem to be working
any ideas?
cd C:\Users\nicho\android-sdks\platform-tools
adb
adb -s emulator-5554 shell logcat -c
adb -s emulator-5554 shell am instrument -w com.example.nicho.pleasework.test/android.test.InstrumentationTestRunner
set timestamp=%date:~-4,4%%date:~-7,2%%date:~-10,2%%time:~0,2%%time:~3,2%%time:~6,2%
adb -s emulator-5554 logcat -d -v time MyTest:I > "C:\Users\nicho\Desktop\logs\robotium\%timestamp%-Robotium_Em_logcat.txt"
adb -s emulator-5554 shell logcat -c
adb -s emulator-5556 shell logcat -c
adb -s emulator-5556 shell am instrument -w com.example.nicho.pleasework.test/android.test.InstrumentationTestRunner
set timestamp=%date:~-4,4%%date:~-7,2%%date:~-10,2%%time:~0,2%%time:~3,2%%time:~6,2%
adb -s emulator-5556 logcat -d -v time MyTest:I > "C:\Users\nicho\Desktop\logs\nexus4\%timestamp%-Nexus_4_logcat.txt"
adb -s emulator-5556 shell logcat -c
I searched a lot for this in Google, but no hope, how to check the OS version of Bluestacks emulator in Windows? There is a video in YouTube for checking bluestack version, but not the Android version used in it.
I went to settings – > Advanced settings, but there was no tab corresponding to About tab which is found in an Android emulator like in the case of Genymotion emulator.
There is an easier way of getting to know the android version without having to install any application.
There are some scripts (php/js) that can detect your android version while visiting websites:
Try; http://demo.mobiledetect.net/ Or;
http://detectmobilebrowsers.com/
Install Terminal Emulator from Play Store, open the application and type:
getprop ro.build.version.release
you will get something like: 4.4.4 for KitKat.
or
getprop ro.build.version.sdk for getting the sdk version which will return 19
Open a browser in Bluestacks and go to http://demo.mobiledetect.net
I have tested this on multiple devices of which the Android version is known, and it is accurate.
Currently responds to Bluestacks as v4.4.2 (Kitkat)
Without any installation, you could use your adb commands.
For example, for your main emulator
adb -s emulator-5554 shell getprop ro.build.version.release
adb -s emulator-5554 shell getprop ro.build.version.sdk
For your multi emulators add up by 10,
adb -s emulator-5564 shell getprop ro.build.version.release
adb -s emulator-5564 shell getprop ro.build.version.sdk
adb -s emulator-5574 shell getprop ro.build.version.release
adb -s emulator-5574 shell getprop ro.build.version.sdk
//... so on
You could also do the shell commands by their local ip,
adb -s 127.0.0.1:5555 shell getprop ro.build.version.release
adb -s 127.0.0.1:5555 shell getprop ro.build.version.sdk
adb -s 127.0.0.1:5565 shell getprop ro.build.version.release
adb -s 127.0.0.1:5565 shell getprop ro.build.version.sdk
adb -s 127.0.0.1:5575 shell getprop ro.build.version.release
adb -s 127.0.0.1:5575 shell getprop ro.build.version.sdk
//... so on
just use Droid Info .. which gives you alot of Information quite easely.
I'm trying to get from the device (running android L) the country and the language with the following commands:
adb shell getprop persist.sys.country
adb shell getprop persist.sys.language
But both return a empty string.
When I try another getprop command, like:
adb shell getprop ro.product.model
It returns the correct value.
Anyone knows what is happening?
Found the solution:
Android has changed this prop name in the last versions. You can use now:
adb shell getprop ro.product.locale
or
adb shell getprop persist.sys.locale
There are some other useful commands related to this question:
adb shell getprop ro.csc.country_code //e.g. [Germany]
adb shell getprop ro.csc.countryiso_code //e.g. [DE]
adb shell getprop ro.csc.sales_code //e.g. [VD2]
It gives information about country and operator the Binary is dedicated to (if not modified of course).