- 構文:
<path-permission android:path="string" android:pathPrefix="string" android:pathPattern="string" android:permission="string" android:readPermission="string" android:writePermission="string" />
- 上位の要素:
<provider>
- 説明:
- コンテンツ プロバイダ内のデータの特定のサブセットに対するパスと必須の権限を定義します。この要素を複数回指定することで、複数のパスを指定できます。
- 属性:
android:path
- コンテンツ プロバイダ データのサブセットの完全 URI パス。このパスで識別される特定のデータに対してのみ、権限を付与できます。検索候補コンテンツの提供に使用する場合、
/search_suggest_query
が追加されます。 android:pathPrefix
- コンテンツ プロバイダ データのサブセットの、URI パスの最初の部分。この最初の部分を共有するパスを持つすべてのデータ サブセットに対して権限を付与できます。
android:pathPattern
- コンテンツ プロバイダ データのサブセットの完全 URI パスを指定しますが、以下のワイルドカードを使用できます。
- アスタリスク(
*
)。直前の文字が 0 個以上出現するシーケンスと一致します。 - ピリオドとそれに続くアスタリスク(
.*
)。0 個以上の文字のシーケンスに一致します。
バックスラッシュ(
\
)は、文字列を XML から読み取る際にエスケープ文字として使用されるため、パターンとして解析される前にダブル エスケープする必要があります。たとえば、リテラル*
は「\\*
」と記述し、リテラル\
は「\\\
」と記述します。これは、Java プログラミング言語で文字列を作成する際の記述方法と同じです。これらの各種パターンについて詳しくは、
PatternMatcher
クラスのPATTERN_LITERAL
、PATTERN_PREFIX
、PATTERN_SIMPLE_GLOB
の説明をご覧ください。 - アスタリスク(
android:permission
- コンテンツ プロバイダのデータを読み書きする際にクライアントが必要とする権限の名前。この属性は、1 つの権限で読み取りと書き込みの両方を設定する際に便利です。ただし、
readPermission
属性とwritePermission
属性の方がこの属性よりも優先されます。 android:readPermission
- コンテンツ プロバイダに対してクエリを行う際にクライアントが必要とする権限。
android:writePermission
- コンテンツ プロバイダが管理しているデータに変更を加える際にクライアントが必要とする権限。
- 導入時の API レベル:
- API レベル 4
- 関連項目:
SearchManager
Manifest.permission
- セキュリティに関するヒント
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-07-27 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-27 UTC。"],[],[],null,["# <path-permission\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cpath-permission android:path=\"string\"\n android:pathPrefix=\"string\"\n android:pathPattern=\"string\"\n android:permission=\"string\"\n android:readPermission=\"string\"\n android:writePermission=\"string\" /\u003e\n ```\n\ncontained in:\n: [\u003cprovider\u003e](/guide/topics/manifest/provider-element)\n\ndescription:\n: Defines the path and required permissions for a specific subset of data\n within a content provider. This element can be\n specified multiple times to supply multiple paths.\n\nattributes:\n:\n\n `android:path`\n : A complete URI path for a subset of content provider data.\n Permission can be granted only to the particular data identified by this path.\n When used to provide search suggestion content, it is appended\n with `/search_suggest_query`.\n\n `android:pathPrefix`\n : The initial part of a URI path for a subset of content provider data.\n Permission can be granted to all data subsets with paths that share this initial part.\n\n `android:pathPattern`\n : A complete URI path for a subset of content provider data,\n but one that can use the following wildcards:\n\n - An asterisk (`*`). This matches a sequence of zero to many occurrences of the immediately preceding character.\n - A period followed by an asterisk (`.*`). This matches any sequence of zero or more characters.\n\n\n Because the backslash (`\\`) 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 \"`\\\\\\`\". This is\n the same as what you write if constructing the string in the Java programming language.\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\n `android:permission`\n : The name of a permission that clients need in order to read or write the\n content provider's data. This attribute is a convenient way of setting a\n single permission for both reading and writing. However, the\n `readPermission` and\n `writePermission` attributes take precedence\n over this one.\n\n `android:readPermission`\n : A permission that clients need in order to query the content provider.\n\n `android:writePermission`\n : A permission that clients need in order to make changes to the data controlled by the content provider.\n\nintroduced in:\n: API level 4\n\nsee also:\n: [SearchManager](/reference/android/app/SearchManager)\n: [Manifest.permission](/reference/android/Manifest.permission)\n: [Security tips](/guide/topics/security/security)"]]