简体   繁体   English

Android:使用广播接收器运行服务。

[英]Android: running a service with a broadcast receiver.

I have this app that I want to run at phone start up (As in after the GUI comes up) but I want it to run in the background(like a service) 我有这个应用程序,我想在手机启动运行(如在GUI出现后)但我希望它在后台运行(如服务)

I know this is possible, since most of the android system is like this. 我知道这是可能的,因为大多数android系统都是这样的。

Any tips would be wonderful! 任何提示都会很精彩!

Create a service in your app. 在您的应用中创建服务。 Bind it to an Activity if you wish. 如果您愿意,可将其绑定到活动。 Subclass BroadcastReceiver to listen to the Android.BOOT_COMPLETED system broadcast. 子类BroadcastReceiver监听Android.BOOT_COMPLETED系统广播。 then start your service. 然后开始你的服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM