如何在 Eclipse 上阻止应用程序自动启动 >跑步
很抱歉,如果有一个简单的答案,但我是 Android 开发新手。 我有一个在启动时启动的服务,以及一个将附加到该服务以配置该服务的 UI。问题是,如果 Activity 是在 AndroidManifest.xml 中定义的,它将在 AVD 启动时自动启动,这会由于服务自动启动以及 Activity 与服务同步而导致一些问题。有人有启动服务和活动的示例吗?
我的活动所做的一件事是检查服务是否正在运行,如果正在运行,它将绑定到它,否则它将启动服务。 (以防服务在启动后被终止)
有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
转到 avd/sdk 管理器,然后从那里启动手机。它将在您的应用程序不出现
窗口的情况下加载 - Android avd 和 sdk 管理器 - 然后选择您的手机并启动
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
我自己还没有完成启动服务,但据我所知,您的 Activity 不应自动启动,只要它不是由您的 IDE 生成,您就应该是安全的。对于 Eclipse,如果您正在使用它,您可以修改启动方式;
希望这有帮助。
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;
Hope this helps.