Though we saw in Chapter 3 how clients use content providers, we provide more
information here for content provider authors to fully implement the
provider public API. For clients to use your content provider, you
will need to create a public API class that contains a set of
constants that clients use to access column fields of
Cursor objects returned by your provider’s
query method. This class will also define the content provider
authority URI that provides the foundation of the whole provider URI
communication scheme. Our class,
the API to our
First we’ll explain the class in pieces, providing background on its fields, and then we’ll show a full listing.
For a client application to query content provider data, it needs
to pass a URI that identifies relevant data to one of the Android
content resolver’s data access methods. These methods,
delete, mirror the methods found on a content resolver that we
define in Writing and Integrating a Content Provider. On receiving such an
invocation, the content resolver will use an authority string to
match the incoming URI with the
CONTENT_URI of each content provider it
knows about to find the right provider for the client. Thus, the
CONTENT_URI defines the type of
URIs your content provider can process.
CONTENT_URI consists of these
A prefix that tells the Android Framework that it must find ...