Detect when Android emulator is fully booted

Catalin Morosan picture Catalin Morosan · Sep 3, 2010 · Viewed 18.1k times · Source

I want to create a script where I start an emulator and after the system is fully booted, I want to install an .apk.

How can I know when the emulator is fully booted so I can run the install command? Here http://developer.android.com/guide/developing/tools/adb.html it is said that adb wait-for-device install <app>.apk is not correct.

So how can I achieve this? Is it possible? Is my only option to sleep for a few minutes until I can be sure that the emulator is started?

Answer

neuron picture neuron · Jan 30, 2013

adb shell getprop init.svc.bootanim

This will tell you whether or not the boot animation is running. It's what we use on our headless build server to check if the emulator is up. The sys.boot_completed from dac2009 is what lead me to find that flag. We use init.svc.bootanim instead because boot_completed has a tendency of triggering too early.