Accessing a database through a broadcastreceiver on RECEIVE_BOOT_COMPLETED

别来无恙 提交于 2019-12-01 08:30:12

You do not want to do database I/O in any manifest-registered broadcast receiver. You do not know how long it will take (based on other device activity), and your onReceive() method is running on the main application thread, so your time is limited and your CPU footprint is large.

Please pass control to an IntentService for doing the database I/O and scheduling your alarms. The IntentService will call your onHandleIntent() on a background thread, so you can take the time you need, and the service automatically goes away when onHandleIntent() completes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!