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

BASH BASHadb 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

BASH BASHadb 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:

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

Share this post on…

  • Mastodon
  • Facebook
  • LinkedIn
  • BlueSky
  • Threads
  • Reddit
  • HackerNews
  • Lobsters
  • WhatsApp
  • Telegram

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="">