Wednesday, June 29, 2011

BroadcastReceiver, BOOT_COMPLETED, and the Emulator

There are plenty of helpful pages out there on how-to's for having your application run on the startup of your Android device. Here are just a few:

What the pages didn't tell you was how you can make sure you have your code setup right with the emulator. For starters, I'm not sure if others have this problem but the power off button on my emulator doesn't even work. It just hangs on the message that reads "Shutting down".

When you try to debug your project from a clean emulator, well your app isn't on there yet when the emulator is loading so you kinda miss the boat.

The message boards indicated you have to run the emulator from the command-line with the app already loaded on it.  Well, I tried that but lazily, I didn't want to go back and figure out what my command-line parameters needed to be to launch it.

So instead, from Eclipse I just went into the Android SDK and AVD Manager (under the Window Menu) and started the emulator from there. I did this of course after loading the app into the emulator. I start the emulator and my BroadcastReceiver on boot works just fine. There was no need to go to running the emulator at the command line.

1 comment: