- syntax:
<grant-uri-permission android:path="string" android:pathPattern="string" android:pathPrefix="string" />
- contained in:
<provider>
- description:
- Specifies the subsets of app data that the parent content provider
has permission to access. Data subsets are indicated by the path part of a
content:
URI. The authority part of the URI identifies the content provider. Granting permission is a way of enabling clients of the provider that don't normally have permission to access its data to overcome that restriction on a one-time basis.If a content provider's
grantUriPermissions
attribute istrue
, permission can be granted for any of the data under the provider's purview. However, if that attribute isfalse
, permission is granted only to data subsets that are specified by this element. A provider can contain any number of<grant-uri-permission>
elements. Each one can specify only one path, using one of the three possible attributes.For information about how permission is granted, see the
<intent-filter>
element'sgrantUriPermissions
attribute. - attributes:
android:path
android:pathPrefix
android:pathPattern
- A path identifying the data subset or subsets that permission can be
granted for. The
path
attribute specifies a complete path. Permission can granted only to the particular data subset identified by that path.The
pathPrefix
attribute specifies the initial part of a path. Permission can be granted to all data subsets with paths that share that initial part. ThepathPattern
attribute specifies a complete path, but one that can contain the following wildcards:- An asterisk (
*
) matches a sequence of zero to many occurrences of the immediately preceding character. A period followed by an asterisk (
.*
) matches any sequence of zero to many characters.
Because
\
is used as an escape character when the string is read from XML, before it is parsed as a pattern, you need to double-escape. For example, a literal*
is written as\\*
and a literal\
is written as\\\
.For more information about these types of patterns, see the descriptions of
PATTERN_LITERAL
,PATTERN_PREFIX
, andPATTERN_SIMPLE_GLOB
in thePatternMatcher
class. - An asterisk (
- introduced in:
- API level 1
- see also:
-
grantUriPermissions
attribute of the<provider>
element
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-03-29 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{
"last_modified": "Last updated 2023-03-29 UTC.",
"state": ""
}