BroadcastReceiver在Activity中注册则要在其中注销

来源:互联网 发布:老挝文字翻译软件 编辑:程序博客网 时间:2024/04/29 05:51

BroadcastReceiver在Activity中注册则要在其中注销

否则会报错

09-06 19:20:25.281 4952-4952/com.segway.robot.client E/ActivityThread: Activity com.segway.robot.client.update.view.UpdateInfoDialogActivity has leaked IntentReceiver com.segway.robot.client.update.model.UpdateDownloadReceiver@381311b that was originally registered here. Are you missing a call to unregisterReceiver()?



但是往往一些后台任务是不想在activity中进行注销的,这个时候可以使用application的context进行注册。




0 0
原创粉丝点击