Wednesday, August 15, 2012

[android-developers] Prevent garbage collection for Broadcast receiver that are dynamically registered

Dear All,

I've developed an app  that registers a receiver in the onResume() constructor.

This receiver need not to be deallocated as it processes intent even when my app is not running on the foreground.

For that reason, the receiver is not deregistered by onPause().

Now, when the app goes in background mode, I get a warning that the receiver has leaked and, since the 4.1 update, the receiver seems to be deallocated from memory (was not the case before).

Question: is there a way to ensure that receiver are programmatically registered at run-time are not deallocated when an app goes in background?

Thanks,

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment