On Thu, Aug 30, 2012 at 5:42 PM, Dave Smith <[email protected]> wrote:
> Does anyone know if there is a way to clear or disable the Messenger when
> the "Operation" is over so it doesn't create this memory leak?

Whatever you do, don't shoot it.

:-)

More seriously, I haven't a clue -- I haven't used Messenger much
across processes.

> Is there perhaps a better way to implement the IPC to the Servicein the
> same fashion, so that multiple disparate objects can make a request and get
> a result asynchronously?

Package a PendingIntent as an extra and have the service send() it.
The client can then choose whether to use a broadcast Intent or
createPendingResult() on an Activity, depending on which makes more
sense. In theory, the security characteristics of a PendingIntent
should allow the BroadcastReceiver to not be exported (if it's defined
in the manifest), though I haven't tried this.

> I'm not convinced that just switching to using a
> bound service implementation will solve this issue as I would will need the
> Messenger to process the callback.

Well, you'd need *something* to process the callback. That could be a
local broadcast via LocalBroadcastManager, using the Handler more
directly (instead of by way of a Messenger), etc.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.1 Available!

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

Reply via email to