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