1page.title=<grant-uri-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"><grant-uri-permission android:<a href="#path">path</a>="<i>string</i>" 9 android:<a href="#path">pathPattern</a>="<i>string</i>" 10 android:<a href="#path">pathPrefix</a>="<i>string</i>" /></pre></dd> 11 12<dt>contained in:</dt> 13<dd><code><a href="{@docRoot}guide/topics/manifest/provider-element.html"><provider></a></code></dd> 14 15<dt>description:</dt> 16<dd itemprop="description">Specifies which data subsets of the parent content provider permission 17can be granted for. Data subsets are indicated by the path part of a 18{@code content:} URI. (The authority part of the URI identifies the 19content provider.) 20Granting permission is a way of enabling clients of the provider that don't 21normally have permission to access its data to overcome that restriction on 22a one-time basis. 23 24<p> 25If a content provider's <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#gprmns">grantUriPermissions</a></code> 26attribute is "{@code true}", permission can be granted for any the data under 27the provider's purview. However, if that attribute is "{@code false}", permission 28can be granted only to data subsets that are specified by this element. 29A provider can contain any number of {@code <grant-uri-permission>} elements. 30Each one can specify only one path (only one of the three possible attributes). 31</p> 32 33<p> 34For information on how permission is granted, see the 35<code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html"><intent-filter></a></code> element's 36<code><a href="{@docRoot}guide/topics/manifest/provider-element.html#gprmsn">grantUriPermissions</a></code> attribute. 37</p></dd> 38 39<dt>attributes:</dt> 40<dd><dl class="attr"> 41<dt><a name="path"></a>{@code android:path} 42<br/>{@code android:pathPrefix} 43<br/>{@code android:pathPattern}</dt> 44<dd>A path identifying the data subset or subsets that permission can be 45granted for. The {@code path} attribute specifies a complete path; 46permission can be granted only to the particular data subset identified 47by that path. 48The {@code pathPrefix} attribute specifies the initial part of a path; 49permission can be granted to all data subsets with paths that share that 50initial part. 51The {@code pathPattern} attribute specifies a complete path, but one 52that can contain the following wildcards: 53 54<ul> 55<li>An asterisk ('{@code *}') matches a sequence of 0 to many occurrences of 56the immediately preceding character.</li> 57 58<li><p>A period followed by an asterisk ("{@code .*}") matches any sequence of 590 to many characters.</p></li> 60</ul> 61 62<p> 63Because '{@code \}' is used as an escape character when the string is read 64from XML (before it is parsed as a pattern), you will need to double-escape: 65For example, a literal '{@code *}' would be written as "{@code \\*}" and a 66literal '{@code \}' would be written as "{@code \\\\}". This is basically 67the same as what you would need to write if constructing the string in Java code. 68</p> 69 70<p> 71For more information on these types of patterns, see the descriptions of 72{@link android.os.PatternMatcher#PATTERN_LITERAL}, 73{@link android.os.PatternMatcher#PATTERN_PREFIX}, and 74{@link android.os.PatternMatcher#PATTERN_SIMPLE_GLOB} in the 75{@link android.os.PatternMatcher} class. 76</p></dd> 77</dl></dd> 78 79<!-- ##api level indication## --> 80<dt>introduced in:</dt> 81<dd>API Level 1</dd> 82 83<dt>see also:</dt> 84<dd>the 85<code><a href="{@docRoot}guide/topics/manifest/provider-element.html#gprmns">grantUriPermissions</a></code> 86attribute of the 87<code><a href="{@docRoot}guide/topics/manifest/provider-element.html"><provider></a></code> 88element</dd> 89 90 91</dl> 92