Reboot and launch an Android app via ADB


I'm using an old Android phone as a webcam. The camera lens is great, the DroidCam software is nifty, but the Android OS behind it is old and dying. My phone often needs rebooting. Which means that the app also needs restarting. The phone's screen faces away from me, so I can't interact with it.

This is a quick guide (mostly notes to myself) about rebooting and starting an app from the command line.

To find the package name, run

adb shell pm list packages -f | grep -i PackageName

In my case, the package is called com.dev47apps.droidcamx

To launch an app from your computer's shell, run

adb shell monkey -p com.dev47apps.droidcamx 1

You can read more about the Android Test Monkey.

Putting it all together in a shell script is as simple as:

adb reboot
sleep 60
adb shell monkey -p com.dev47apps.droidcamx 1

Share this post on…

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <p> <pre> <br> <img src="" alt="" title="" srcset="">

Discover more from Terence Eden’s Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading