Content Providers


(This is a response to a post by nish1013, which I inadvertently deleted. [It’s a long story.])

He asks:

And right he is. We do not have any Content Provider implementations in our book. We also don’t cover service binding, AIDL, or Messengers in any depth.

Content Providers have something in common with these other tools: they’re mainly useful for communicating between applications.

99.9% of Android applications do not expose any significant API to other applications, with the notable exception of Intents. In our practice, we have never found it necessary to go to the trouble of implementing a Content Provider. Since our book is for beginners, and we have never found Content Providers indispensable, we thought we could serve our readers better by addressing other topics. (We do cover reading data from Content Providers in other apps, since that’s a lot more common).

If you’re interested in Content Providers, we recommend checking out a book that covers more topics than ours. Reto Meier’s Professional Android 4 Application Development is a good choice, and you really can’t beat Mark Murphy’s Busy Coder’s Guide To Android Development for breadth.

There’s a reason for this: in our own practice, we only use Content Providers when it is necessary. As a result, we only rarely use them.