1

onCreate我注册的方法的主要活动中,broadcastReciver但是当我关闭应用程序时,我总是收到此错误:

@429d47e0 that was originally registered here. Are you missing a call to unregisterReceiver()?
04-10 23:40:48.161: E/ActivityThread(20989):    at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:793)
04-10 23:40:48.161: E/ActivityThread(20989):    at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)
04-10 23:40:48.161: E/ActivityThread(20989):    at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1274)
04-10 23:40:48.161: E/ActivityThread(20989):    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1261)
04-10 23:40:48.161: E/ActivityThread(20989):    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1255)
04-10 23:40:48.161: E/ActivityThread(20989):    at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:372)

当我关闭应用程序时,我不想取消注册接收器。我能做些什么?我以编程方式注册接收器。

4

1 回答 1

4

当我关闭应用程序时,我不想取消注册接收器

那么你不应该通过registerReceiver(). <receiver>而是通过一个元素在清单中注册它。然后,无论您的应用程序是否正在运行,它都是可用的。

于 2013-04-10T21:56:31.700 回答