views:

110

answers:

2

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?

+3  A: 

You can set a broadcast receiver which can notify that the device boot is complete

android:name="android.intent.action.BOOT_COMPLETED"

Check this link out

http://www.androidcompetencycenter.com/2009/06/start-service-at-boot/

Rahul
This is not what I am asking. I'm talking about making a script on my home computer to install the application on the emulator to be able to automate the testing process.
kaciula
Oops!..your title read "Detect when Android emulator is fully booted" and i thought this would be the best possible approach. Any how even if you want to run a script from your system you need to know when the stimulator boot is complete. May be you can start some kind of service from the broadcast that can call a URL in your Local IIS which can fire your script...
Rahul
A: 

You may parse the stdout output of the emulator if you start it with "-logcat VERBOSE" and wait for a message which indicates that the emulator is booted.

I didn't saw any good message right now in the output, but you may write an app which is listening for "android.intend.action.BOOT_COMPLETED" and writes something to the log.

Refer http://developer.android.com/guide/developing/tools/emulator.html for more info.

Luminger