简体   繁体   中英

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)

I know this is possible, since most of the android system is like this.

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. then start your service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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