BroadcastReceiver卸载问题
来源:互联网 发布:淘宝小清新店铺装修 编辑:程序博客网 时间:2024/05/08 09:25
10-27 00:38:44.953: E/ActivityThread(10801): android.app.IntentReceiverLeaked: Activity com.freshen.test.TestLocationActivity has leaked IntentReceiver com.freshen.test.TestLocationActivity$1@40522d28 that was originally registered here. Are you missing a call to unregisterReceiver()?
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:799)
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:575)
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:852)
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.ContextImpl.registerReceiver(ContextImpl.java:839)
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.ContextImpl.registerReceiver(ContextImpl.java:833)
10-27 00:38:44.953: E/ActivityThread(10801): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:318)
10-27 00:38:44.953: E/ActivityThread(10801): at com.freshen.test.TestLocationActivity.onCreate(TestLocationActivity.java:43)
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1794)
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851)
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.ActivityThread.access$1500(ActivityThread.java:132)
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
10-27 00:38:44.953: E/ActivityThread(10801): at android.os.Handler.dispatchMessage(Handler.java:99)
10-27 00:38:44.953: E/ActivityThread(10801): at android.os.Looper.loop(Looper.java:143)
10-27 00:38:44.953: E/ActivityThread(10801): at android.app.ActivityThread.main(ActivityThread.java:4277)
10-27 00:38:44.953: E/ActivityThread(10801): at java.lang.reflect.Method.invokeNative(Native Method)
10-27 00:38:44.953: E/ActivityThread(10801): at java.lang.reflect.Method.invoke(Method.java:507)
10-27 00:38:44.953: E/ActivityThread(10801): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
10-27 00:38:44.953: E/ActivityThread(10801): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
10-27 00:38:44.953: E/ActivityThread(10801): at dalvik.system.NativeStart.main(Native Method)
=============================================================================================================
public abstract Intent registerReceiver (BroadcastReceiver receiver, IntentFilter filter)
Register a BroadcastReceiver to be run in the main activity thread. The receiver will be called with any broadcast Intent that matches filter, in the main application thread.
The system may broadcast Intents that are "sticky" -- these stay around after the broadcast as finished, to be sent to any later registrations. If your IntentFilter matches one of these sticky Intents, that Intent will be returned by this function and sent to your receiver as if it had just been broadcast.
There may be multiple sticky Intents that match filter, in which case each of these will be sent to receiver. In this case, only one of these can be returned directly by the function; which of these that is returned is arbitrarily decided by the system.
If you know the Intent your are registering for is sticky, you can supply null for your receiver. In this case, no receiver is registered -- the function simply returns the sticky Intent that matches filter. In the case of multiple matches, the same rules as described above apply.
See BroadcastReceiver
for more information on Intent broadcasts.
As of ICE_CREAM_SANDWICH
, receivers registered with this method will correctly respect the setPackage(String)
specified for an Intent being broadcast. Prior to that, it would be ignored and delivered to all matching registered receivers. Be careful if using this for security.
Note: this method cannot be called from a BroadcastReceiver
component; that is, from a BroadcastReceiver that is declared in an application's manifest. It is okay, however, to call this method from another BroadcastReceiver that has itself been registered at run time with registerReceiver(BroadcastReceiver, IntentFilter)
, since the lifetime of such a registered BroadcastReceiver is tied to the object that registered it.
Parameters
Returns
- The first sticky intent found that matches filter, or null if there are none.
See Also
registerReceiver(BroadcastReceiver, IntentFilter, String, Handler)
sendBroadcast(Intent)
unregisterReceiver(BroadcastReceiver)
- BroadcastReceiver卸载问题
- android BroadcastReceiver 生命周期的问题
- 基于BroadCastReceiver的SD卡装载卸载实例!
- Android BroadcastReceiver之APP安装、更新、卸载的监听
- BroadcastReceiver
- BroadcastReceiver
- BroadcastReceiver
- BroadcastReceiver
- BroadcastReceiver
- BroadcastReceiver
- BroadcastReceiver
- BroadcastReceiver
- BroadcastReceiver
- BroadCastReceiver
- BroadcastReceiver
- broadcastReceiver
- BroadcastReceiver
- BroadcastReceiver
- JavaScript拖拽图片二
- Java 编程一些容易忽视的错误 1: String 是常量
- ue打开ini文档时显示函数列表的设置方法
- 【ubuntu】安装svn
- 读《程序员修炼之道》之笔记
- BroadcastReceiver卸载问题
- iOS TCP UDP通信
- 数据挖掘1之简介
- 实务:宣告专利权无效的基本思路(上)
- 【PHP】缓存技术
- 反编译apk
- cocos2d-x 2.X demo学习笔记 7 ----RotateWorldTest CCScene全部旋转
- oracle 11g 学习笔记 10_26
- MapView之上添加浮动按钮