ADB command for starting/killing apps and simulating button presses? - EVO 4G Q&A, Help & Troubleshooting

I'm trying to write a script that does a few things, first, starts a program on my phone called Tetherbot, then clicks a button on the application (to start the proxy). Then runs a few ADB commands. Problem is that I can't figure out how to launch a program with ADB or how to simulate clicks on a button in ADB.
In addition, I need to know how to kill an application with ADB (for when I'm done).
EDIT: Got everything I need...
Start:
adb shell am start -a android.intent.action.MAIN -n graha.ms.tunnel/graha.ms.tunnel.TunnelConfig ##start new instance of tetherbot or bring current one to front
adb shell input keyevent 19 ###press up
adb shell input keyevent 66 ###press enter
adb shell am start -a android.intent.category.HOME -n com.fede.launcher/.Launcher
adb forward tcp:1080 tcp:1080
Stop:
adb shell am start -a android.intent.action.MAIN -n graha.ms.tunnel/graha.ms.tunnel.TunnelConfig ##start new instance of tetherbot or bring current one to front
adb shell input keyevent 19 ###press up
adb shell input keyevent 22 ###press right
adb shell input keyevent 66 ###press enter
adb shell am start -a android.intent.category.HOME -n com.fede.launcher/.Launcher

Related

[Q] Please help with Rage Temproot during Gfree root process

Please help, I've searched around and can't find the solution to my issue, I'm rooting following the XDA wiki for Gfree and using the Android SDK....I've managed to get the ADB to recognize my phone and I "think" that the ADB has been able to push the first 5 files to the SD....but I'm stuck on the last command line.
$ adb push su /sdcard/su
$ adb push Superuser.apk /sdcard/Superuser.apk
$ adb push rage /data/local/tmp/rage
$ adb push busybox /data/local/tmp/busybox
$ adb push root /data/local/tmp/root
$ adb shell chmod 0755 /data/local/tmp/*
when I run $ adb shell chmod 0755 /data/local/tmp/*
I get the following:
Usage: chmod <MODE> <File>
so then I go to terminal emulator on the phone and type
$ /data/local/tmp/rage
I get: /data/local/tmp/rage: not found
Where have I screwed up?
G2_Gordon_G1 said:
Please help, I've searched around and can't find the solution to my issue, I'm rooting following the XDA wiki for Gfree and using the Android SDK....I've managed to get the ADB to recognize my phone and I "think" that the ADB has been able to push the first 5 files to the SD....but I'm stuck on the last command line.
$ adb push su /sdcard/su
$ adb push Superuser.apk /sdcard/Superuser.apk
$ adb push rage /data/local/tmp/rage
$ adb push busybox /data/local/tmp/busybox
$ adb push root /data/local/tmp/root
$ adb shell chmod 0755 /data/local/tmp/*
when I run $ adb shell chmod 0755 /data/local/tmp/*
I get the following:
Usage: chmod <MODE> <File>
so then I go to terminal emulator on the phone and type
$ /data/local/tmp/rage
I get: /data/local/tmp/rage: not found
Where have I screwed up?
Click to expand...
Click to collapse
looks like you screwed up the last command ... didnt write the syntax properly thats why it showed its usage.....
(adb shell chmod 0755 /data/local/tmp/*) this command that is.....
also the last thing showing file not found means the files were never pushed to the phone..... connect your phone to your pc in chagre only and usb debigging connected mode and in command prompt in the adb folder write "adb devices"
it should show somehting like this.....
adb list of devices attached
SH034N34GF
this number over here (SH034N34GF) is an example ... it will show your phone ID... which would be different....
if you see list of devices attached and an empty line below and no serial number as shown in example....
than it means your android usb drivers for adb shell are not set up correctly
in that case ... get the drivers set up properly....
check with adb devices command to confirm your phone is recognized....
than start over with the commands
I've started over and have typed VERY CAREFULLY...
On each of the first five command prompts I get a 40 or so line message that starts with:
Android Debug Bridge version 1.0.26
.......
(list of commands)
.......
and ends with
bug tags are printed.
OK so I guess that's good
So then I type C:\> adb shell chmod 0755 /data/local/tmp/*
and NOW I get
adb server is out of date. killing...
*daemon started successfully*
Bad Mode
Clearly, I'm a noob.....
Now what?
read this guide .... on it search for .... "out of date" author explains how to tackle it
G2_Gordon_G1 said:
I've started over and have typed VERY CAREFULLY...
On each of the first five command prompts I get a 40 or so line message that starts with:
Android Debug Bridge version 1.0.26
.......
(list of commands)
.......
and ends with
bug tags are printed.
OK so I guess that's good
So then I type C:\> adb shell chmod 0755 /data/local/tmp/*
and NOW I get
adb server is out of date. killing...
*daemon started successfully*
Bad Mode
Clearly, I'm a noob.....
Now what?
Click to expand...
Click to collapse
hispeedworm said:
read this guide .... on it search for .... "out of date" author explains how to tackle it
Click to expand...
Click to collapse
In the ADB guide it says:
"By the way, the first adb command that you type may well also come up with some lines similar to "adb deamon out of date" etc, but don't worry, that's normal, just check the rest of the output."
So apparently that's not a problem?
G2_Gordon_G1 said:
In the ADB guide it says:
"By the way, the first adb command that you type may well also come up with some lines similar to "adb deamon out of date" etc, but don't worry, that's normal, just check the rest of the output."
So apparently that's not a problem?
Click to expand...
Click to collapse
im uploading my adb... its minimal with just adb fastboot and few other files.... unzip into a folder on your pc.....use these instead of the android sdk and all..
make sure that folder is linked in windows..... Step 4 of the adb for noobs guide..... reinstall the android usb drivers again following the guide.....
when thats done restart and press F8 ... disable signature verification ... when windows loaded... go to command prompt.... do into the adb directory.....than write adb devices....if it shows you device than start over with the commands.... you should not get the error saying out of date... as i just used this adb shell 2 days back to root my desire Z.....
hope this helps
Thanks! Will try again soon!

[Q] Internal Memory data recovery

[email protected] /cygdrive/c/Users/user/Desktop
$ adb forward tcp:5555 tcp:5555
bash: adb: command not found
[email protected] /cygdrive/c/Users/user/Desktop
$ adb shell
bash: adb: command not found
[email protected] /cygdrive/c/Users/user/Desktop
$ /system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12
Can you help ? when i paste this command(adb forward tcp:5555 tcp:5555
adb shell
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12) on cgywin this what happens.
i really want my phone's internal memory back. it's taken from this guide : http://forum.xda-developers.com/gala...y-yes-t1994705 +,when he says to open another terminal ,he means another window of cygwn not just the one i am using ?
i Really need your advice. i want to recover every kind of data from before the format. adb is installed ,nc is in the folder it's suppose to be ,busybox and the other app installed on my device. all are set in their place.
im on my pc win 7 downloaded and did what is on the guide...
+what does it mean connect your phone in adb mode and unlock the screen ? i connent my phone normally through usb and my adb detects my phone in the list in the commmand prompt and thats all ...
is there a mode i am suppose to be into while accessing my phone through usb cable from my pc ?
Edit : i saw a guide about it , i try now ...

Simple batch to send URL and open to Firestick over ADB...

Make this a .bat script. Edit the two lines. Run the file and verify debugging on TV. Copy everything below this.
@Echo off
echo FireStick ADB interface initializing...
REM edit this to abd.exe directory v
cd /d C:\Android\Adb\
adb connect 192.168.x.x
REM Firestick IP here ^
echo.
echo.
echo.
echo.
set /p UserInputPath=What is the URL? (type "exit" to kill adb and exit)
IF "%UserInputPath%"=="exit" (
adb kill-server
exit
)
timeout -t 3
adb shell am start -a android.intent.action.VIEW -d %UserInputPath%
adb kill-server
exit

HDMI-CEC Control via adb shell on Fire TV 4K.

Hi,
you can switch to the Fire TV 4K's HDMI Port by pressing home or via adb by simulating adb shell input keyevent KEYCODE_HOME.
I'd like to make the Fire TV also to switch to other hdmi inputs. For example adb manual allows the following command:
"key_tv_satellite_service": "adb shell input keyevent 240", "key_tv_network": "adb shell input keyevent 241", "key_tv_antenna_cable": "adb shell input keyevent 242", "key_tv_input_hdmi_1": "adb shell input keyevent 243", "key_tv_input_hdmi_2": "adb shell input keyevent 244", "key_tv_input_hdmi_3": "adb shell input keyevent 245", "key_tv_input_hdmi_4": "adb shell input keyevent 246", "key_tv_input_composite_1": "adb shell input keyevent 247", "key_tv_input_composite_2": "adb shell input keyevent 248", "key_tv_input_component_1": "adb shell input keyevent 249", "key_tv_input_component_2": "adb shell input keyevent 250",
But they don't seem towork on the Fire TV 4k. Only Home command switched HDMI input.
Is there a away to also issue these hdmi commands via Fire TV 4k?

TCL C825 switch to HDMI1/2/3 input - IR or adb command

Hello,
Did anyone discover a way to switch directly to HDMI1/2/3 ?
Either using IR or an ADB command?
finally discovered a way! with adb:
HDMI1
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.tcl.tvinput%2F.passthroughinput.TvPassThroughService%2FHW1413744128
HDMI2
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.tcl.tvinput%2F.passthroughinput.TvPassThroughService%2FHW1413744384
HDMI3
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.tcl.tvinput%2F.passthroughinput.TvPassThroughService%2FHW1413744640
HDMI4
adb shell am start -a android.intent.action.VIEW -d content://android.media.tv/passthrough/com.tcl.tvinput%2F.passthroughinput.TvPassThroughService%2FHW1413745664
credits to diegodanado

Categories

Resources