- 문법:
<grant-uri-permission android:path="string" android:pathPattern="string" android:pathPrefix="string" />
- 포함된 위치:
<provider>
- 설명
- 상위 콘텐츠 제공자에 액세스 권한이 있는 앱 데이터의 하위 집합을 지정합니다. 데이터 하위 집합은
content:
URI의 경로 부분으로 나타냅니다. URI의 권한 부분은 콘텐츠 제공자를 식별합니다. 권한 부여는 일반적으로 데이터 액세스 권한이 없는 제공자의 클라이언트가 일회성으로 제한을 극복할 수 있도록 하는 방법입니다.콘텐츠 제공자의
grantUriPermissions
속성이true
이면 제공자의 범위 내에 있는 모든 데이터에 관한 권한을 부여할 수 있습니다. 그러나 이 속성이false
이면 이 요소에서 지정한 데이터 하위 집합에만 권한이 부여됩니다. 제공자는<grant-uri-permission>
요소를 원하는 만큼 포함할 수 있습니다. 각 속성은 하나의 경로만 지정할 수 있으므로 가능한 세 가지 속성 중 하나를 사용합니다.권한 부여 방법에 관한 자세한 내용은
<intent-filter>
요소의grantUriPermissions
속성을 참고하세요. - 속성:
android:path
android:pathPrefix
android:pathPattern
- 권한이 부여될 수 있는 데이터 하위 집합을 식별하는 경로입니다.
path
속성은 전체 경로를 지정합니다. 권한은 해당 경로로 식별된 특정 데이터 하위 집합에만 부여될 수 있습니다.pathPrefix
속성은 경로의 시작 부분을 지정합니다. 이 시작 부분을 공유하는 경로를 가진 모든 데이터 하위 집합에 권한을 부여할 수 있습니다.pathPattern
속성은 다음 와일드 카드를 포함할 수 있는 전체 경로를 지정합니다.*
: 별표를 사용하면 바로 앞에 있는 문자가 0번 이상 나오는 일치 항목을 찾습니다..*
: 마침표 다음에 별표를 사용하면 0자 이상 일치하는 항목을 찾습니다.
\
는 XML에서 문자열을 읽을 때 이스케이프 문자로 사용되므로 패턴으로 파싱되기 전에 두 번 이스케이프 처리해야 합니다. 예를 들어 리터럴*
는\\*
로 작성되고 리터럴\
는\\\
로 작성됩니다.이러한 유형의 패턴에 관한 자세한 내용은
PatternMatcher
클래스의PATTERN_LITERAL
,PATTERN_PREFIX
,PATTERN_SIMPLE_GLOB
설명을 참고하세요.
- 도입 수준:
- API 수준 1
- 참고 항목:
<provider>
요소의grantUriPermissions
속성
<grant-uri-permission>
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# <grant-uri-permission\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cgrant-uri-permission android:path=\"string\"\n android:pathPattern=\"string\"\n android:pathPrefix=\"string\" /\u003e\n ```\n\ncontained in:\n: [\u003cprovider\u003e](/guide/topics/manifest/provider-element)\n\ndescription:\n: Specifies the subsets of app data that the parent content provider\n has permission to access. Data subsets are indicated by the path part of a\n `content:` URI. The authority part of the URI identifies the\n content provider.\n Granting permission is a way of enabling clients of the provider that don't\n normally have permission to access its data to overcome that restriction on\n a one-time basis.\n\n\n If a content provider's [grantUriPermissions](/guide/topics/manifest/provider-element#gprmsn)\n attribute is `true`, permission can be granted for any of the data under\n the provider's purview. However, if that attribute is `false`, permission\n is granted only to data subsets that are specified by this element.\n A provider can contain any number of `\u003cgrant-uri-permission\u003e` elements.\n Each one can specify only one path, using one of the three possible attributes.\n\n\n For information about how permission is granted, see the\n [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element) element's\n [grantUriPermissions](/guide/topics/manifest/provider-element#gprmsn) attribute.\n\nattributes:\n:\n\n `android:path`\n\n `android:pathPrefix`\n\n `android:pathPattern`\n : A path identifying the data subset or subsets that permission can be\n granted for. The `path` attribute specifies a complete path.\n Permission can granted only to the particular data subset identified\n by that path.\n\n \u003cbr /\u003e\n\n\n The `pathPrefix` attribute specifies the initial part of a path.\n Permission can be granted to all data subsets with paths that share that\n initial part.\n The `pathPattern` attribute specifies a complete path, but one\n that can contain the following wildcards:\n\n - An asterisk (`*`) matches a sequence of zero to many occurrences of the immediately preceding character.\n - A period followed by an asterisk (`.*`) matches any sequence of\n zero to many characters.\n\n\n Because `\\` is used as an escape character when the string is read\n from XML, before it is parsed as a pattern, you need to double-escape.\n For example, a literal `*` is written as `\\\\*` and a\n literal `\\` is written as `\\\\\\`.\n\n\n For more information about these types of patterns, see the descriptions of\n [PATTERN_LITERAL](/reference/android/os/PatternMatcher#PATTERN_LITERAL),\n [PATTERN_PREFIX](/reference/android/os/PatternMatcher#PATTERN_PREFIX), and\n [PATTERN_SIMPLE_GLOB](/reference/android/os/PatternMatcher#PATTERN_SIMPLE_GLOB) in the\n [PatternMatcher](/reference/android/os/PatternMatcher) class.\n\nintroduced in:\n: API level 1\n\nsee also:\n:\n [grantUriPermissions](/guide/topics/manifest/provider-element#gprmsn)\n attribute of the\n [\u003cprovider\u003e](/guide/topics/manifest/provider-element)\n element"]]