permission-element.jd revision 3001a035439d8134a7d70d796376d1dfbff3cdcd
1page.title=<permission>
2@jd:body
3
4<dl class="xml">
5<dt>syntax:</dt></dt>
6<dd><pre class="stx">&lt;permission android:<a href="#desc">description</a>="<i>string resource</i>"
7            android:<a href="#icon">icon</a>="<i>drawable resource</i>"
8            android:<a href="#label">label</a>="<i>string resource</i>"
9            android:<a href="#nm">name</a>="<i>string</i>"
10            android:<a href="#pgroup">permissionGroup</a>="<i>string</i>"
11            android:<a href="#plevel">protectionLevel</a>=["normal" | "dangerous" | 
12                                     "signature" | "signatureOrSystem"] /&gt;</pre></dd>
13
14<dt>contained in:</dt>
15<dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code></dd>
16
17<dt>description:</dt>
18<dd>Declares a security permission that can be used to limit access 
19to specific components or features of this or other applications.  
20See the <a href="{@docRoot}guide/topics/manifest/manifest-intro.html#perms">Permissions</a>
21section in the introduction,
22and the <a href="{@docRoot}guide/topics/security/security.html">Security and Permissions</a> 
23document for more information on how permissions work.</dd>
24
25<dt>attributes:</dt>
26<dd><dl class="attr">
27<dt><a name="desc"></a>{@code android:description}</dt>
28<dd>A user-readable description of the permission, longer and more 
29informative than the label.  It may be displayed to explain the 
30permission to the user &mdash; for example, when the user is asked 
31whether to grant the permission to another application.
32
33<p>
34This attribute must be set as a reference to a string resource; 
35unlike the {@code label} attribute, it cannot be a raw string.
36</p></dd>
37
38<dt><a name="icon"></a>{@code android:icon}</dt>
39<dd>A reference to a drawable resource for an icon that represents the 
40permission.</dd>
41
42<dt><a name="label"></a>{@code android:label}</dt>
43<dd>A name for the permission, one that can be displayed to users. 
44
45<p>
46As a convenience, the label can be directly set 
47as a raw string while you're developing the application.  However, 
48when the application is ready to be published, it should be set as a 
49reference to a string resource, so that it can be localized like other 
50strings in the user interface.
51</p></dd>
52
53<dt><a name="nm"></a>{@code android:name}</dt>
54<dd>The name of the permission.  This is the name that will be used in 
55code to refer to the permission &mdash; for example, in a 
56<code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code> element and the
57{@code permission} attributes of application components.
58
59<p>
60The name must be unique, so it should use Java-style scoping &mdash; 
61for example, "{@code com.example.project.PERMITTED_ACTION}".
62</p></dd>
63
64<dt><a name="pgroup"></a>{@code android:permissionGroup}</dt>
65<dd>Assigns this permission to a group.  The value of this attribute is 
66the name of the group, which must be declared with the 
67<code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></code> element in this 
68or another application.  If this attribute is not set, the permission
69does not belong to a group.</dd>
70
71<dt><a name="plevel"></a>{@code android:protectionLevel}</dt>
72<dd>Characterizes the potential risk implied in the permission and
73indicates the procedure the system should follow when determining
74whether or not to grant the permission to an application requesting it. 
75The value can be set to one of the following strings:
76
77<table>
78<tr>
79   <th>Value</th>
80   <th>Meaning</th>
81</tr><tr>
82   <td>"{@code normal}"</td>
83   <td>The default value.  A lower-risk permission that gives requesting 
84       applications access to isolated application-level features, with 
85       minimal risk to other applications, the system, or the user.  
86       The system automatically grants this type
87       of permission to a requesting application at installation, without
88       asking for the user's explicit approval (though the user always
89       has the option to review these permissions before installing).
90</tr><tr>
91   <td>"{@code dangerous}"</td>
92   <td>A higher-risk permission that would give a requesting application
93       access to private user data or control over the device that can
94       negatively impact the user.  Because this type of permission
95       introduces potential risk, the system may not automatically
96       grant it to the requesting application.  For example, any dangerous
97       permissions requested by an application may be displayed to the
98       user and require confirmation before proceeding, or some other
99       approach may be taken to avoid the user automatically allowing
100       the use of such facilities.
101</tr><tr>
102   <td>"{@code signature}"</td>
103   <td>A permission that the system grants only if the requesting
104       application is signed with the same certificate as the application
105       that declared the permission. If the certificates match, the system
106       automatically grants the permission without notifying the user or
107       asking for the user's explicit approval.
108</tr><tr>
109   <td>"{@code signatureOrSystem}"</td>
110   <td>A permission that the system grants only to applications that are 
111       in the Android system image <em>or</em> that are signed with the same
112       certificates as those in the system image.  Please avoid using this 
113       option, as the {@code signature} protection level should be sufficient 
114       for most needs and works regardless of exactly where applications are 
115       installed.  The "{@code signatureOrSystem}"
116       permission is used for certain special situations where multiple
117       vendors have applications built into a system image and need
118       to share specific features explicitly because they are being built
119       together.
120</tr>
121</table>
122</dd>
123</dl></dd>
124
125<dt>see also:</dt>
126<dd><code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code>
127<br/><code><a href="{@docRoot}guide/topics/manifest/permission-tree-element.html">&lt;permission-tree&gt;</a></code>
128<br/><code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></code></dd>
129</dd>
130
131</dl>
132