How to hot reboot android device - android

Does anyone know the command to hot reboot that you would use in the terminal emeulator? Would it be a command similar to the the normal reboot commands. If anyone could help thankx.

Probably depends on what do you mean by hot.
Anyway, you can use:
$ adb -s <SERIALNO> reboot
or
$ adb -s <SERIALNO> shell 'stop; sleep 5; start'

Related

Is there any command for installing an app in Genymotion?

Hey guise I want to install an app on several devices in Genymotion by using terminal in ubuntu. Each time I do this:
adb install package.app
It gives me the below error:
error: more than one device/emulator
- waiting for device -
error: more than one device/emulator
I also read about
adb -s udid uninstall package.app
but this is not the solve I want. I don't want to use udid and also I don't know which device has my app from before?
Any suggestions?!
adb help is not extremely clear on what to do:
-d - directs command to the only connected USB device...
-e - directs command to the only running emulator...
-s <serial number> ...
-p <product name or path> ...
The flag you decide to use has to come before the actual adb command:
adb -e install path/to/app.apk
You cannot pass adb commands when there are more than one device connected and running at the same time ; this is a limitation with adb.
Wow finally!
I found this command as my answer:
adb devices | awk 'NR>1{print $1}' | xargs -n1 -I% adb -s % install app.apk
Thanks to sivze

adb shell "watch" command to monitor

I am trying to monitor some commands in my adb shell and I could go watch adb shell <command> but the extra time to have to connect up to the shell is killing me.
Does the Android adb shell have its own version of watch so I can monitor some commands
while true; do <command>; sleep 2; done

How to run shell command in unrooted device

$adb push ./asl-native /data/local/asl-native
$adb shell /system/bin/chmod 0777 /data/local/asl-native
above two lines can be executed in unrooted android device using Runtime.getRuntime().exec() command in program.
Is there any way to run the below command in unrooted device.
(Note:This command will run correctly in rooted device)
$adb shell "/data/local/asl-native /data/local/asl-native.log" &
if it is possible using jni or ndk,please explain the steps.
Reference: From ASL(Android Screenshot Library)
You can Try this:(01234ABC is your device)
1) adb -s 01234ABC shell
2) shell#android:/ $ run-as com.nitesh.tiwari
Hope this could help :)

how to run binary in android without adb shell

when you run a binary in adb shell, if you exit adb, then the process is over too.
So is there a way to run a binary without adb's help?
If you have busybox installed on your device, then you could use 'busybox nohup [your binary] &' command. This way it will keep running even after you close adb
This works for me:
sh -c "your-binary-or-command" &
Then you can exit the adb shell by pressing ctrl+D and it will continue to run.
You can kill it by going back into the adb shell then
kill -s KILL <PID>

How to use android monkey

I am a little confused on how to actually use monkey, i thought you were supposed to power on your emulator and go into terminal editor and type:
$ adb shell monkey -p insert.my.package.name.here -v 500
since that did not work (error, adb: permission denied)
i tried monkey -p insert.blah.blah -v 500 and this comes up that it has been killed, what am I doing wrong?
It's probably trying to talk to a device over your USB port.
You probably just need to add an -e in there to tell adb to connect to the emulator:
$ adb shell monkey -p insert.my.package.name.here -v 500
(Or -s serialnum if you have more than one emulator running.)
See Directing commands in the ADB docs.
It's well explained here:
https://android.googlesource.com/platform/development/+/master/cmds/monkey/README.NETWORK.txt
it's a tool for testing apps, and the port indicates which porto to connect (binds to localhost) to issue remote commands

Categories

Resources