Architecture of Content Providers

Description

Each content provider on a device registers itself like a web site with a string called an authority.

The authority string forms the basis of a set of URIs that this content provider can offer.

This authority registration is defined in the AndroidManifest.xml file.

Example

Here are two examples of how you can register providers in AndroidManifest.xml:


<provider android:name="SomeProvider"
          android:authorities="com.your-company.SomeProvider" />
//from  www.j  av a  2s .c o  m
<provider android:name="NotePadProvider"
          android:authorities="com.google.provider.NotePad"/>

Note

An authority is like a domain name for that content provider.

A content provider, like a web site, has a base domain name that acts as a starting URL.

Given the preceding authority registration, these providers will take URLs starting with that authority prefix:


content://com.your-company.SomeProvider/
content://com.google.provider.NotePad/

The providers offered by Android may not have a fully qualified authority name.

For example, contacts as opposed to com.google.android.contacts.





















Home »
  Android »
    Android Basics »




Hello Android
Resources
Activity
Calendar
Camera
Contact
Content Provider
Database
Hardware
Intent
Location
Media
Network
Notification
Preference
Sensor
Service
SMS