path-permission-element.jd revision 3155825c256b150cfa635ad27ac7a2bab76371b0
1page.title=<path-permission>
2parent.title=The AndroidManifest.xml File
3parent.link=manifest-intro.html
4@jd:body
5
6<dl class="xml">
7<dt>syntax:</dt>
8<dd><pre class="stx">
9&lt;path-permission android:<a href="#path">path</a>="<i>string</i>"
10                 android:<a href="#pathPrefix">pathPrefix</a>="<i>string</i>"
11                 android:<a href="#pathPattern">pathPattern</a>="<i>string</i>"
12                 android:<a href="#permission">permission</a>="<i>string</i>"
13                 android:<a href="#readPermission">readPermission</a>="<i>string</i>"
14                 android:<a href="#writePermission">writePermission</a>="<i>string</i>" /&gt;
15</pre></dd>
16
17<dt>contained in:</dt>
18<dd><code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code></dd>
19
20<!--
21<dt>can contain:</dt>
22</dd>
23-->
24
25<dt>description:</dt>
26<dd itemprop="description">Defines the path and required permissions for a specific subset of data
27within a content provider. This element can be
28specified multiple times to supply multiple paths.
29
30</dd>
31
32<dt>attributes:</dt>
33
34<dd><dl class="attr">
35<dt><a name="path"></a>{@code android:path}</dt>
36<dd>A complete URI path for a subset of content provider data. 
37Permission can be granted only to the particular data identified by this path. 
38When used to provide search suggestion content, it must be appended 
39with "/search_suggest_query".
40</dd>
41
42<dt><a name="pathPrefix"></a>{@code android:pathPrefix}</dt>
43<dd>The initial part of a URI path for a subset of content provider data.
44Permission can be granted to all data subsets with paths that share this initial part.
45</dd>
46
47<dt><a name="pathPattern"></a>{@code android:pathPattern}</dt>
48<dd>A complete URI path for a subset of content provider data,
49but one that can use the following wildcards:
50 
51<ul> 
52<li>An asterisk ('<code class="Code prettyprint">*</code>'). This matches a sequence of 0 to many occurrences of
53the immediately preceding character.</li> 
54 
55<li>A period followed by an asterisk ("<code class="Code prettyprint">.*</code>"). This matches any sequence of 
560 or more characters.</li> 
57</ul> 
58 
59<p> 
60Because '<code class="Code prettyprint">\</code>' is used as an escape character when the string is read 
61from XML (before it is parsed as a pattern), you will need to double-escape.
62For example, a literal '<code class="Code prettyprint">*</code>' would be written as "<code class="Code prettyprint">\\*</code>" and a 
63literal '<code class="Code prettyprint">\</code>' would be written as "<code class="Code prettyprint">\\</code>".  This is basically 
64the same as what you would need to write if constructing the string in Java code.
65</p> 
66<p> 
67For more information on these types of patterns, see the descriptions of 
68<a href="/reference/android/os/PatternMatcher.html#PATTERN_LITERAL">PATTERN_LITERAL</a>,
69<a href="/reference/android/os/PatternMatcher.html#PATTERN_PREFIX">PATTERN_PREFIX</a>, and
70<a href="/reference/android/os/PatternMatcher.html#PATTERN_SIMPLE_GLOB">PATTERN_SIMPLE_GLOB</a> in the
71<a href="/reference/android/os/PatternMatcher.html">PatternMatcher</a> class.
72</p>
73</dd>
74
75<dt><a name="permission"></a>{@code android:permission}</dt>
76<dd>The name of a permission that clients must have in order to read or write the
77content provider's data.  This attribute is a convenient way of setting a 
78single permission for both reading and writing.  However, the 
79<code>readPermission</code> and 
80<code>writePermission</code> attributes take precedence
81over this one.
82</dd> 
83
84<dt><a name="readPermission"></a>{@code android:readPermission}</dt>
85<dd>A permission that clients must have in order to query the content provider.
86</dd> 
87
88<dt><a name="writePermission"></a>{@code android:writePermission}</dt>
89<dd>A permission that clients must have in order to make changes to the data controlled by the content provider.
90</dd> 
91
92
93
94</dl></dd>
95
96<!-- ##api level indication## -->
97<dt>introduced in:</dt>
98<dd>API Level 4</dd>
99
100<dt>see also:</dt>
101<dd>{@link android.app.SearchManager}</dd>
102<dd>{@link android.Manifest.permission}</dd>
103<dd><a href="/guide/topics/security/security.html">Security and
104Permissions</a></dd>
105
106</dl>
107