Android - 如何在启动时运行应用程序的服务组件
可能的重复:
尝试在 Android 上启动服务 < /p>
我我正在编写一个具有两个组件的应用程序:前端活动和后台服务。该活动将允许指定选项,例如要使用的后台服务的更新间隔。
后台服务生成并管理多个线程,这些线程涉及提取用户的位置并将其发送到服务器。
我希望应用程序的“服务”组件在启动时运行。由于该活动仅用于设置某些设置,因此该服务可以使用预定义的设置(从上次输入存储)运行。如果用户想要更改它们,那么他可以启动该活动。
有关于如何执行此操作的示例吗?
(想想高级任务杀手。它在启动时如何运行?)
Possible Duplicate:
Trying to start a service on boot on Android
I am writing an application that has two components, a frontend activity and a background service. The activity will allow one to specify options such as an update interval for the background service to use.
The background service spawns and manages several threads involved in pulling the user's location and sending it to a server.
I would like the "service" component of the application to run at startup. Since the activity is only used to set some settings the service could run using predefined settings (stored from last input). If the user would like to change them then he can initiate the activity.
Any examples on how to do this?
(Think advanced task killer. How does this run at startup?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信这个问题类似于 #2784441。
I believe this question is similar to #2784441.