Detect when Android emulator is fully booted Detect when Android emulator is fully booted android android

Detect when Android emulator is fully booted


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.


while [ "`adb shell getprop sys.boot_completed | tr -d '\r' `" != "1" ] ; do sleep 1; done

This code gets the information from sys.boot_completed if the system boot is complete, removes a newline and compares the resulting value to 1. If its unequal 1/ not booted completly/ it will just sleep 1 second and tries again.

Just put your adb install... after this line of code.


Im not sure if this works on all devices, but it works on the ones I have tested.

If you go into the shell, you can type getprop, and get a list of phone properties. There should be one called "sys.boot_completed".

If you type "getprop sys.boot_completed" it will respond "1" if the system is booted, and an empty string if the system is not booted.