Sorry if there is a simple answer to this, but I am new to Android development. I have a service that starts on boot-up, and a UI that will attach to the service to configure the service. The problem is that if the Activity is defined in the AndroidManifest.xml it will automatically 开发者_运维百科launch on the AVD startup, which is causing some issues due to the Service auto-starting, and the Activity syncronizing with the service. Does anyone have any examples of an Bootup service and activity?
One thing that my activity does is check to see if the service is running, if so it will bind to it, else it will start a service. (incase the service is killed post-boot)
Thoughts?
Go to the avd / sdk manager and just start the phone from there. it will load without your app appearing
window - Android avd and sdk manager - then select your phone and start
I haven't done boot up services myself but afaik your Activity should not start automatically and you should be safe as long as it's not spawned by your IDE. With Eclipse, if you're using it, you can modify launching from;
- Right click on your project in Package Explorer.
- Select "Run As" / "Run Configurations..."
- After you have launched your application once there should be a launch configuration for your project under Android Application list.
Hope this helps.
精彩评论