Friday, March 11, 2011

Re: [android-developers] Binding to a service from within a ContentProvider - when to unbind?

Thanks Dianne. I couldn't find any information on the lifecycle of a ContentProvider in the docs.

I've just ran a few tests and from what I can see, the ContentProvider is created when the process for the app is created (either because of some Activity being started or Service etc).

Now, if the ContentProvider is keeping the Service alive by not unbinding, then doesn't that mean the process is running at a higher ranking than it would otherwise?

How would you recommend to handle the bindings/unbindings:

1. onCreate()/shutdown()
2. lazily bind in first call to, say, query() and unbind in shutdown()
3. Use a CursorFactory to bind/unbind as necessary - i.e. bind when the first cursor is created, unbind when the last cursor is closed.
4. something else?

--
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