I get the following error
"Are you missing a call to unregister receiver"
when I hit the back button to exit my application. How do I identify which Receiver is causing the leak and eliminate the error? I am using the code "DownLoader" from Google to download an expansion file.
10-27 22:13:32.818: E/ActivityThread(30744): Activity com.ssowens.groovebasstrial.BassActivity has leaked IntentReceiver com.immersion.android.haptics.HapticFeedbackManager$HapticFeedbackBroadcastReceiver@41d166d0 that was originally registered here. Are you missing a call to unregisterReceiver()?
10-27 22:13:32.818: E/ActivityThread(30744): android.app.IntentReceiverLeaked: Activity com.ssowens.groovebasstrial.BassActivity has leaked IntentReceiver com.immersion.android.haptics.HapticFeedbackManager$HapticFeedbackBroadcastReceiver@41d166d0 that was originally registered here. Are you missing a call to unregisterReceiver()?
10-27 22:13:32.818: E/ActivityThread(30744): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:800)
10-27 22:13:32.818: E/ActivityThread(30744): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:601)
10-27 22:13:32.818: E/ActivityThread(30744): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1650)
10-27 22:13:32.818: E/ActivityThread(30744): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1630)
10-27 22:13:32.818: E/ActivityThread(30744): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1624)
10-27 22:13:32.818: E/ActivityThread(30744): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:430)
10-27 22:13:32.818: E/ActivityThread(30744): at com.immersion.android.haptics.HapticFeedbackManager.setupPackageBroadcastReceiver(HapticFeedbackManager.java:564)
10-27 22:13:32.818: E/ActivityThread(30744): at com.immersion.android.haptics.HapticFeedbackManager.<init>(HapticFeedbackManager.java:108)
10-27 22:13:32.818: E/ActivityThread(30744): at com.immersion.android.HapticFeedbackManagerProxy.initialize(HapticFeedbackManagerProxy.java:90)
10-27 22:13:32.818: E/ActivityThread(30744): at com.immersion.android.HapticFeedbackManagerProxy.access$100(HapticFeedbackManagerProxy.java:30)
10-27 22:13:32.818: E/ActivityThread(30744): at com.immersion.android.HapticFeedbackManagerProxy$1$1.run(HapticFeedbackManagerProxy.java:71)
10-27 22:13:32.818: E/ActivityThread(30744): at java.lang.Thread.run(Thread.java:856)
Solution 1.
If You have a ListView with a ItemClickListener You have to set the listener to null on overrive Method onPause.
listView.setOnItemClickListener(exampleListener);
Example: Declaration of your listener
private OnItemClickListener exampleListener = new OnItemClickListener() {}....
@Override
public void onPause() {
super.onPause();
listView.setOnItemClickListener(null);
}
@Override
public void onResume() {
super.onResume();
if(listView != null){
listView.setOnItemClickListener(exampleListener);
}
}
Solution 2 If You know what is your broadcastReceiver instance You have to unregister always un overrive method onPause.
@Override protected void onPause() {
super.onPause();
synchronized (this) {
if(broadcastReceiverInstance != null){
unregisterReceiver(broadcastReceiverInstance );
}
}
}
The second solution I know it does not work for you but I let it for reference.
I hope it helps You.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With