@@ -5,7 +5,9 @@ parent.link=manifest-intro.html
55
66<dl class="xml">
77<dt>syntax:</dt>
8- <dd><pre class="stx"><provider android:<a href="#auth">authorities</a>="<i>list</i>"
8+ <dd>
9+ <pre class="stx">
10+ <provider android:<a href="#auth">authorities</a>="<i>list</i>"
911 android:<a href="#enabled">enabled</a>=["true" | "false"]
1012 android:<a href="#exported">exported</a>=["true" | "false"]
1113 android:<a href="#gprmsn">grantUriPermissions</a>=["true" | "false"]
@@ -20,69 +22,81 @@ parent.link=manifest-intro.html
2022 android:<a href="#sync">syncable</a>=["true" | "false"]
2123 android:<a href="#wprmsn">writePermission</a>="<i>string</i>" >
2224 . . .
23- </provider></pre></dd>
25+ </provider></pre>
26+ </dd>
2427
2528<dt>contained in:</dt>
26- <dd><code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code></dd>
29+ <dd>
30+ <code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code>
31+ </dd>
2732
2833<dt>can contain:</dt>
2934<dd><code><a href="{@docRoot}guide/topics/manifest/meta-data-element.html"><meta-data></a></code>
3035<br/><code><a href="{@docRoot}guide/topics/manifest/grant-uri-permission-element.html"><grant-uri-permission></a></code>
3136<br/><code><a href="{@docRoot}guide/topics/manifest/path-permission-element.html"><path-permission></a></code></dd>
3237
3338<dt>description:</dt>
34- <dd>Declares a content provider — a subclass of
35- {@link android.content.ContentProvider} — that supplies structured
36- access to data managed by the application. All content providers that
37- are part of the application must be represented by {@code <provider>}
38- elements in the manifest file. The system cannot see, and therefore will
39- not run, any that are not declared. (You need to declare only
40- those content providers that you develop as part of your application,
41- not those developed by others that your application uses.)
42-
43- <p>
44- The Android system identifies content providers by the authority part
45- of a {@code content:} URI. For example, suppose that the following URI
46- is passed to <code>{@link android.content.ContentResolver#query
47- ContentResolver.query()}</code>:
48-
49- <p style="margin-left: 2em">{@code content://com.example.project.healthcareprovider/nurses/rn}</p>
50-
51- <p>
52- The {@code content:} scheme identifies the data as belonging to a content
53- provider and the authority ({@code com.example.project.healthcareprovider})
54- identifies the particular provider. The authority therefore must be unique.
55- Typically, as in this example, it's the fully qualified name of a
56- ContentProvider subclass. The path part of a URI may be used by a content
57- provider to identify particular data subsets, but those paths are not
58- declared in the manifest.
59- </p>
60-
61- <p>
62- For information on using and developing content providers, see a separate document,
63- <a href="{@docRoot}guide/topics/providers/content-providers.html">Content Providers</a>.
64- </p></dd>
39+ <dd>
40+ Declares a content provider component. A content provider is a subclass of
41+ {@link android.content.ContentProvider} that supplies structured access to data managed by the
42+ application. All content providers in your application must be defined in a
43+ {@code <provider>} element in the manifest file; otherwise, the system is unaware of them
44+ and doesn't run them.
45+ <p>
46+ You only declare content providers that are part of your application. Content providers in
47+ other applications that you use in your application should not be declared.
48+ </p>
49+ <p>
50+ The Android system stores references to content providers according to an <b>authority</b>
51+ string, part of the provider's <b>content URI</b>. For example, suppose you want to
52+ access a content provider that stores information about health care professionals. To do
53+ this, you call the method
54+ {@link android.content.ContentResolver#query ContentResolver.query()}, which among other
55+ arguments takes a URI that identifies the provider:
56+ </p>
57+ <pre>
58+ content://com.example.project.healthcareprovider/nurses/rn
59+ </pre>
60+ <p>
61+ The <code>content:</code> <b>scheme</b> identifies the URI as a content URI pointing to
62+ an Android content provider. The authority
63+ <code>com.example.project.healthcareprovider</code> identifies the provider itself; the
64+ Android system looks up the authority in its list of known providers and their authorities.
65+ The substring <code>nurses/rn</code> is a <b>path</b>, which the content provider can use
66+ to identify subsets of the provider data.
67+ </p>
68+ <p>
69+ Notice that when you define your provider in the <code><provider></code> element, you
70+ don't include the scheme or the path in the <code>android:name</code> argument, only the
71+ authority.
72+ </p>
73+ <p>
74+ For information on using and developing content providers, see the API Guide,
75+ <a href="{@docRoot}guide/topics/providers/content-providers.html">Content Providers</a>.
76+ </p>
77+ </dd>
6578
6679<dt>attributes:</dt>
67- <dd><dl class="attr">
68- <dt><a name="auth"></a>{@code android:authorities}</dt>
69- <dd>A list of one or more URI authorities that identify data under the purview
70- of the content provider.
71- Multiple authorities are listed by separating their names with a semicolon.
72- To avoid conflicts, authority names should use a Java-style naming convention
73- (such as {@code com.example.provider.cartoonprovider}). Typically, it's the name
74- of the ContentProvider subclass.
75-
76- <p>
77- There is no default. At least one authority must be specified.
78- </p></dd>
79-
80- <dt><a name="enabled"></a>{@code android:enabled}</dt>
81- <dd>Whether or not the content provider can be instantiated by the system —
82- "{@code true}" if it can be, and "{@code false}" if not. The default value
83- is "{@code true}".
84-
85- <p>
80+ <dd>
81+ <dl class="attr">
82+ <dt><a name="auth"></a>{@code android:authorities}</dt>
83+ <dd>
84+ A list of one or more URI authorities that identify data offered by the content provider.
85+ Multiple authorities are listed by separating their names with a semicolon.
86+ To avoid conflicts, authority names should use a Java-style naming convention
87+ (such as {@code com.example.provider.cartoonprovider}). Typically, it's the name
88+ of the {@link android.content.ContentProvider} subclass that implements the provider
89+ <p>
90+ There is no default. At least one authority must be specified.
91+ </p>
92+ </dd>
93+
94+ <dt><a name="enabled"></a>{@code android:enabled}</dt>
95+ <dd>Whether or not the content provider can be instantiated by the system —
96+ "{@code true}" if it can be, and "{@code false}" if not. The default value
97+ is "{@code true}".
98+
99+ <p>
86100The <code><a href="{@docRoot}guide/topics/manifest/application-element.html"><application></a></code> element has its own
87101<code><a href="{@docRoot}guide/topics/manifest/application-element.html#enabled">enabled</a></code> attribute that applies to all
88102application components, including content providers. The
@@ -93,17 +107,37 @@ are by default) for the content provider to be enabled. If either is
93107</p></dd>
94108
95109<dt><a name="exported"></a>{@code android:exported}</dt>
96- <dd>Whether or not the content provider can be used by components of other
97- applications — "{@code true}" if it can be, and "{@code false}" if not.
98- If "{@code false}", the provider is available only to components of the
99- same application or applications with the same user ID. The default value
100- is "{@code true}" for applications which target API level 16 (Jelly Bean)
101- and below, and "{@code false}" otherwise.
102-
103- <p>
104- You can export a content provider but still limit access to it with the
105- <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#prmsn">permission</a></code> attribute.
106- </p></dd>
110+ <dd>
111+ Whether the content provider is available for other applications to use:
112+ <ul>
113+ <li>
114+ <code>true</code>: The provider is available to other applications. Any application can
115+ use the provider's content URI to access it, subject to the permissions specified for
116+ the provider.
117+ </li>
118+ <li>
119+ <code>false</code>: The provider is not available to other applications. Set
120+ <code>android:exported="false"</code> to limit access to the provider to your
121+ applications. Only applications that have the same user ID (UID) as the provider will
122+ have access to it.
123+ </li>
124+ </ul>
125+ <p>
126+ The default value is <code>"true"</code> for applications that set either
127+ <code><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">android:minSdkVersion</a></code>
128+ or
129+ <code><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">android:targetSdkVersion</a></code> to
130+ <code>"16"</code> or lower. For applications that
131+ set either of these attributes to <code>"17"</code> or higher, the default is
132+ <code>"false"</code>.
133+ </p>
134+ <p>
135+ You can set <code>android:exported="false"</code> and still limit access to your
136+ provider by setting permissions with the
137+ <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#prmsn">permission</a></code>
138+ attribute.
139+ </p>
140+ </dd>
107141
108142<dt><a name="gprmsn"></a>{@code android:grantUriPermissions}</dt>
109143<dd>Whether or not those who ordinarily would not have permission to
0 commit comments