Android API Guides 之 App Manifest(14) - <path-permission>

本文深入解析Android应用中Content Provider的<path-permission>元素,详细阐述其语法、包含项、属性及其作用,包括路径权限、权限名称、读写权限等关键概念,帮助开发者更好地管理和控制数据访问。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<path-permission>

SYNTAX:
<path-permission android:path="string"
                 android:pathPrefix="string"
                 android:pathPattern="string"
                 android:permission="string"
                 android:readPermission="string"
                 android:writePermission="string" />
CONTAINED IN:
<provider>
DESCRIPTION:
Defines the path and required permissions for a specific subset of data within a content provider. This element can be specified multiple times to supply multiple paths.
ATTRIBUTES:
android:path
A complete URI path for a subset of content provider data. Permission can be granted only to the particular data identified by this path. When used to provide search suggestion content, it must be appended with "/search_suggest_query".
android:pathPrefix
The initial part of a URI path for a subset of content provider data. Permission can be granted to all data subsets with paths that share this initial part.
android:pathPattern
A complete URI path for a subset of content provider data, but one that can use the following wildcards:
  • An asterisk ('*'). This matches a sequence of 0 to many occurrences of the immediately preceding character.
  • A period followed by an asterisk (".*"). This matches any sequence of 0 or more characters.

Because '\' is used as an escape character when the string is read from XML (before it is parsed as a pattern), you will need to double-escape. For example, a literal '*' would be written as "\\*" and a literal '\' would be written as "\\". This is basically the same as what you would need to write if constructing the string in Java code.

For more information on these types of patterns, see the descriptions of PATTERN_LITERAL,PATTERN_PREFIX, and PATTERN_SIMPLE_GLOB in the PatternMatcher class.

android:permission
The name of a permission that clients must have in order to read or write the content provider's data. This attribute is a convenient way of setting a single permission for both reading and writing. However, the  readPermission and  writePermission attributes take precedence over this one.
android:readPermission
A permission that clients must have in order to query the content provider.
android:writePermission
A permission that clients must have in order to make changes to the data controlled by the content provider.
INTRODUCED IN:
API Level 4
SEE ALSO:
SearchManager
Manifest.permission
Security and Permissions

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值