I am developing an android application on android.
Is it possible (via DDMS or adb shell) for me to do a thread dump of all the threads of my application?
In addition to what ddms supports, via the adb shell you can run
ps -t
or
top -t
While most android shell commands are primitive and take only a subset of standard options, top seems to have some built in help it prints when bad options are given, ps did not, but fortunately its source code is available to examine.
Related
I've search a lot and I can't get which port is my app using.
I tried using adb shell netstat -n but I'm not sure if this command is showing me anything related to my app.
I want to create files with different sizes on an Android device.
The one approach I have already tried was to create dummy files using fsutil and push it to devices.
Is there any way to achieve similar result with a command inside adb shell?
Yes, you can do it using dd command. I am not pretty sure it's available in your device. It works fine in my device, you can give a try.
In your host which connects with your Android device, with adb debug turn on, using the following command to create dummy file.
adb shell 'dd if=/dev/zero of=/data/local/tmp/test.img bs=4k count=800'
# check the result
adb shell ls -l /data/local/tmp/test.img
-rw------- shell shell 3276800 2017-06-21 17:33 test.img
The command above will get data from /dev/zero and output to /data/local/tmp/test.img (a public writable directory for Android device), adjust bs and count value in your situation.
I am working with an application which browses into the Video gallery of a device which uses Android OS following code starts the browsing process. This is what my guess is because the code is folliwed by DPAD_left and DPAD_center commands.
"shell am start -a android.intent.action.MAIN -n com.android.music/.VideoBrowserActivity"
I did not find much help where I can understand what does this command exactly do but assuming that my previous assumptions is correct that it helps browse in the video gallery of the phone, is there any command which I can use to list all the files in the same directory?
I tried to look for the command on ADB web sire but did not find anything like that. Any ideas?
I guess you are looking for
$ adb shell ls /path/to/directory/with/videos
Can anyone tell me how can we get adb logs using eggPlant automation tool.Actually i want to have adb logs for my device when running eggPlant scripts.
Please help me out in this situation.
Actually, the previous answer is incorrect as adb command support does exist in eggPlant. There are ways to get adb logs in eggPlant. Here's how:
adb logcat is the command that enables getting adb logs. (Warning: This will print a ton of info!)
You need a way to execute adb logcat within eggPlant. This is accomplished using the shell command
On some systems (I am using eggPlant for Windows) you need to dump the output of the shell command to a file and then read the file back into a variable.
I guess there is no such command or something else.eggPlant identifies only object or script to execute the command.
I have a little script that I run in adb shell of Android phone (/system/etc directory), which enables to communicate with the modem by sending/receiving a single AT command.
The script itself, if run in adb shell, works OK. That's what it looks like:
cat /dev/pts/7 &
echo -e $1\\r > /dev/pts/7
Here's the output in adb shell:
# ./sendATCommand "at+cops?"
./sendATCommand "at+cops?"
#
+COPS: 0,0,"AT&T",6
OK
/dev/pts/7: invalid length
(need to press ENTER to return control to adb shell)
#
Now I want to invoke this script from a powershell script running on my PC, thus eventually controlling modem via AT commands, but nothing happens.
For example, the below powershell script will send the command at+cops? to check the operator to which mobile is registered to:
$adb = [IO.Path]::Combine([IO.Path]::Combine($Env:ANDROID, "platform-tools"), "adb.exe")
& $adb remount
$atCommand = "at+cops?"
& $adb shell /system/etc/sendATCommand $atCommand
The output may looks sometimes like +ATCMD (any residual [proprietary]AT command sitting in device buffer after bootup), or at+cops?(echo), or nothing at all, but
never +COPS: 0,0,"AT&T",6 which I expect. Could you help me figure out what's going on and how to possibly fix it? Ideally
I want to be able to execute at command, return control to powershell, and have output available for further processing.
I am also open to other solutions to implement same thing.
Would greatly appreciate your help. Thanks!
Not sure to answer your question, my phone is not an Android, but when I connect it via buetooth or USB to my computer a COM port is created. So I build an assembly tool on the top of .NET SerialPort class that allow, for example, to send SMS using the phone Modem.
I think it's usable in your case.