Ahsan Tarique Ahsan Tarique - 22 days ago 12
Android Question

Terminate process after some time in ADB shell

I am running an app from ADB shell like this:

adb shell am start -n mypackage/.MainActivity


I need to terminate the app automatically after 10 seconds and start another application.
I am trying to do something like this:

adb shell timeout -t 10 am start -n mypackage/.MainActivity


But unfortunately this does not work.

Output:


/system/bin/sh: timeout not found


Is there any way to make this work?

Answer

Use following

adb shell am start -n mypackage1/.MainActivity
sleep 10
kill  mypackage1
adb shell am start -n mypackage2/.MainActivity

More Info here

Comments