I coded an app which starts at the system start up and starts a service which is written in the code. The code is working fine and the service is getting started when the app is installed on a real android device but not on an emulator. I do not have a real device always handy. Any idea how to simulate a start up in an emulator?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I just found a way to simulate a start-up without having to stop-and-start the emulator. Go to the DDMS perspective (if you are using Eclipse) and "stop" the android.core
process. This process respawns (you would know this if you have ever owned a HTC where that essential process seemed to stop wayyy to often) and that process of respawning will effectively reboot the emulator- i.e the BOOT event is fired.
回答2:
Starting emulator simulates a boot up. Didn't know it earlier as I was missing the Toast
which I had put up on the boot up for some reasons I don't know. When tried on a faster machine, the same code worked like charm. :)