Home | History | Annotate | Download | only in manifest
      1 page.title=<grant-uri-permission>
      2 parent.title=The AndroidManifest.xml File
      3 parent.link=manifest-intro.html
      4 @jd:body
      5 
      6 <dl class="xml">
      7 <dt>syntax:</dt>
      8 <dd><pre class="stx">&lt;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>" /&gt;</pre></dd>
     11 
     12 <dt>contained in:</dt>
     13 <dd><code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code></dd>
     14 
     15 <dt>description:</dt>
     16 <dd>Specifies which data subsets of the parent content provider permission
     17 can 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
     19 content provider.)  
     20 Granting permission is a way of enabling clients of the provider that don't 
     21 normally have permission to access its data to overcome that restriction on 
     22 a one-time basis.
     23 
     24 <p> 
     25 If a content provider's <code><a href="{@docRoot}guide/topics/manifest/provider-element.html#gprmns">grantUriPermissions</a></code> 
     26 attribute is "{@code true}", permission can be granted for any the data under 
     27 the provider's purview.  However, if that attribute is "{@code false}", permission 
     28 can be granted only to data subsets that are specified by this element.  
     29 A provider can contain any number of {@code &lt;grant-uri-permission&gt;} elements.  
     30 Each one can specify only one path (only one of the three possible attributes).
     31 </p>
     32 
     33 <p>
     34 For information on how permission is granted, see the 
     35 <code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</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 
     45 granted for.  The {@code path} attribute specifies a complete path; 
     46 permission can be granted only to the particular data subset identified 
     47 by that path.  
     48 The {@code pathPrefix} attribute specifies the initial part of a path; 
     49 permission can be granted to all data subsets with paths that share that 
     50 initial part.   
     51 The {@code pathPattern} attribute specifies a complete path, but one 
     52 that can contain the following wildcards:
     53 
     54 <ul>
     55 <li>An asterisk ('{@code *}') matches a sequence of 0 to many occurrences of
     56 the immediately preceding character.</li>
     57 
     58 <li><p>A period followed by an asterisk ("{@code .*}") matches any sequence of 
     59 0 to many characters.</p></li>
     60 </ul>
     61 
     62 <p>
     63 Because '{@code \}' is used as an escape character when the string is read 
     64 from XML (before it is parsed as a pattern), you will need to double-escape:  
     65 For example, a literal '{@code *}' would be written as "{@code \\*}" and a 
     66 literal '{@code \}' would be written as "{@code \\\\}".  This is basically 
     67 the same as what you would need to write if constructing the string in Java code.
     68 </p>
     69 
     70 <p>
     71 For 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>
     86 attribute of the 
     87 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code> 
     88 element</dd>
     89 
     90 
     91 </dl>
     92