Home | History | Annotate | Download | only in manifest
      1 page.title=Bn k khai ng dng
      2 @jd:body
      3 
      4 <div id="qv-wrapper">
      5 <div id="qv">
      6 
      7 <h2>Trong ti liu ny</h2>
      8 <ol>
      9 <li><a href="#filestruct">Cu trc ca Tp Bn k khai</a></li>
     10 <li><a href="#filec">Cc Quy c Tp</a>
     11 <li><a href="#filef">Cc Tnh nng Tp</a>
     12 	<ol>
     13 	<li><a href="#ifs">B lc  nh</a></li>
     14 	<li><a href="#iconlabel">Biu tng v Nhn</a></li>
     15 	<li><a href="#perms">Quyn</a></li>
     16 	<li><a href="#libs">Th vin</a></li>
     17 	</ol></li>
     18 </ol>
     19 </div>
     20 </div>
     21 
     22 <p>
     23   Mi ng dng u phi c mt tp AndroidManifest.xml (chnh xc l
     24   tn gi ny) trong th mc gc ca mnh. <span itemprop="description">Tp bn k khai
     25   trnh by nhng thng tin thit yu v ng dng ca bn vi h thng Android,
     26   thng tin m h thng phi c trc khi c th chy bt k m no
     27   ca ng dng.</span> Ngoi mt s mc ch khc, bn k khai thc hin nhng iu sau:
     28 </p>
     29 
     30 <ul>
     31 <li>N t tn gi Java cho ng dng.
     32 Tn gi ng vai tr nh mt m nhn din duy nht cho ng dng.</li>
     33 
     34 <li>N m t cc thnh phn ca ng dng &mdash; hot ng, 
     35 dch v, hm nhn qung b, v trnh cung cp ni dung m ng dng 
     36 c son bi.  N t tn cc lp trin khai tng thnh phn v 
     37 cng b cc kh nng ca chng (v d, nhng tin nhn {@link android.content.Intent 
     38 Intent} m chng c th x l).  Nhng khai bo ny cho php h thng Android 
     39 bit cc thnh phn l g v chng c th c khi chy trong nhng iu kin no.</li>
     40 
     41 <li>N xc nh nhng tin trnh no s lu tr cc thnh phn ng dng.</li>  
     42 
     43 <li>N khai bo cc quyn m ng dng phi c  
     44 truy cp cc phn c bo v ca API v tng tc vi cc ng dng khc.</li>  
     45 
     46 <li>N cng khai bo cc quyn m ng dng khc phi c  
     47 tng tc vi cc thnh phn ca ng dng.</li>
     48 
     49 <li>N lit k cc lp {@link android.app.Instrumentation} cung cp 
     50 tnh nng to h s v cc thng tin khc khi ng dng ang chy.  Nhng khai bo ny 
     51 ch xut hin trong bn k khai khi ng dng ang c pht trin v 
     52 th nghim; chng b loi b trc khi ng dng c cng b.</li>
     53 
     54 <li>N khai bo mc ti thiu ca API Android m ng dng 
     55 yu cu.</li>
     56 
     57 <li>N lit k cc th vin m ng dng phi c lin kt vi.</li>
     58 </ul>
     59 
     60 
     61 <h2 id="filestruct">Cu trc ca Tp Bn k khai</h2>
     62 
     63 <p>
     64 S  bn di minh ha cu trc chung ca tp bn k khai v mi 
     65 phn t m n c th cha.  Tng phn t, cng vi tt c thuc tnh 
     66 ca mnh, s c lp ti liu theo di y  vo mt tp ring.   xem thng tin 
     67 chi tit v mi phn t, hy nhp vo tn phn t trong s , 
     68 trong danh sch cc phn t theo th t ch ci m tun theo s , hoc trn bt k
     69 ni dung no khc  cp ti tn phn t. 
     70 </p>
     71 
     72 <pre>
     73 &lt;?xml version="1.0" encoding="utf-8"?&gt;
     74 
     75 <a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a>
     76 
     77     <a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission /&gt;</a>
     78     <a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission /&gt;</a>
     79     <a href="{@docRoot}guide/topics/manifest/permission-tree-element.html">&lt;permission-tree /&gt;</a>
     80     <a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group /&gt;</a>
     81     <a href="{@docRoot}guide/topics/manifest/instrumentation-element.html">&lt;instrumentation /&gt;</a>
     82     <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk /&gt;</a>
     83     <a href="{@docRoot}guide/topics/manifest/uses-configuration-element.html">&lt;uses-configuration /&gt;</a>  <!-- ##api level 3## -->
     84     <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">&lt;uses-feature /&gt;</a>  <!-- ##api level 4## -->
     85     <a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">&lt;supports-screens /&gt;</a>  <!-- ##api level 4## -->
     86     <a href="{@docRoot}guide/topics/manifest/compatible-screens-element.html">&lt;compatible-screens /&gt;</a>  <!-- ##api level 9## -->
     87     <a href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">&lt;supports-gl-texture /&gt;</a>  <!-- ##api level 11## -->
     88 
     89     <a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a>
     90 
     91         <a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a>
     92             <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a>
     93                 <a href="{@docRoot}guide/topics/manifest/action-element.html">&lt;action /&gt;</a>
     94                 <a href="{@docRoot}guide/topics/manifest/category-element.html">&lt;category /&gt;</a>
     95                 <a href="{@docRoot}guide/topics/manifest/data-element.html">&lt;data /&gt;</a>
     96             <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;/intent-filter&gt;</a>
     97             <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data /&gt;</a>
     98         <a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;/activity&gt;</a>
     99 
    100         <a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a>
    101             <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a> . . . <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;/intent-filter&gt;</a>
    102             <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data /&gt;</a>
    103         <a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;/activity-alias&gt;</a>
    104 
    105         <a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a>
    106             <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a> . . . <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;/intent-filter&gt;</a>
    107             <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data/&gt;</a>
    108         <a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;/service&gt;</a>
    109 
    110         <a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a>
    111             <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a> . . . <a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;/intent-filter&gt;</a>
    112             <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data /&gt;</a>
    113         <a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;/receiver&gt;</a>
    114 
    115         <a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a>
    116             <a href="{@docRoot}guide/topics/manifest/grant-uri-permission-element.html">&lt;grant-uri-permission /&gt;</a>
    117             <a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data /&gt;</a>
    118             <a href="{@docRoot}guide/topics/manifest/path-permission-element.html">&lt;path-permission /&gt;</a>
    119         <a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;/provider&gt;</a>
    120 
    121         <a href="{@docRoot}guide/topics/manifest/uses-library-element.html">&lt;uses-library /&gt;</a>
    122 
    123     <a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;/application&gt;</a>
    124 
    125 <a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;/manifest&gt;</a>
    126 </pre>
    127 
    128 <p>
    129 Tt c phn t c th xut hin trong tp bn k khai c lit k  bn di 
    130 theo th t ch ci.  y l nhng phn t hp php duy nht; bn khng th 
    131 thm cc phn t hay thuc tnh ca chnh mnh.  
    132 </p>
    133 
    134 <p style="margin-left: 2em">
    135 <code><a href="{@docRoot}guide/topics/manifest/action-element.html">&lt;action&gt;</a></code>
    136 <br/><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
    137 <br/><code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>
    138 <br/><code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code>
    139 <br/><code><a href="{@docRoot}guide/topics/manifest/category-element.html">&lt;category&gt;</a></code>
    140 <br/><code><a href="{@docRoot}guide/topics/manifest/data-element.html">&lt;data&gt;</a></code>
    141 <br/><code><a href="{@docRoot}guide/topics/manifest/grant-uri-permission-element.html">&lt;grant-uri-permission&gt;</a></code>
    142 <br/><code><a href="{@docRoot}guide/topics/manifest/instrumentation-element.html">&lt;instrumentation&gt;</a></code>
    143 <br/><code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code>
    144 <br/><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code>
    145 <br/><code><a href="{@docRoot}guide/topics/manifest/meta-data-element.html">&lt;meta-data&gt;</a></code>
    146 <br/><code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    147 <br/><code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></code>
    148 <br/><code><a href="{@docRoot}guide/topics/manifest/permission-tree-element.html">&lt;permission-tree&gt;</a></code>
    149 <br/><code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code>
    150 <br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>
    151 <br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>
    152 <br/><code><a href="{@docRoot}guide/topics/manifest/supports-screens-element.html">&lt;supports-screens&gt;</a></code>  <!-- ##api level 4## -->
    153 <br/><code><a href="{@docRoot}guide/topics/manifest/uses-configuration-element.html">&lt;uses-configuration&gt;</a></code>  <!-- ##api level 3## -->
    154 <br/><code><a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">&lt;uses-feature&gt;</a></code>  <!-- ##api level 4## -->
    155 <br/><code><a href="{@docRoot}guide/topics/manifest/uses-library-element.html">&lt;uses-library&gt;</a></code>
    156 <br/><code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code>
    157 <br/><code><a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">&lt;uses-sdk&gt;</a></code>
    158 </p>
    159 
    160 
    161     
    162 
    163 <h2 id="filec">Cc Quy c Tp</h2>
    164 
    165 <p>
    166 Mt s quy c v quy tc p dng chung cho tt c cc phn t v thuc tnh 
    167 trong bn k khai:
    168 </p>
    169 
    170 <dl>
    171 <dt><b>Phn t</b></dt>
    172 <dd>Ch cc phn t 
    173 <code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> v
    174 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
    175 l bt buc phi c, chng u phi c mt v ch c th xy ra mt ln.  
    176 Hu ht cc phn t khc c th xy ra nhiu ln hoc khng xy ra &mdash; mc d t 
    177 nht mt vi trong s chng phi c mt  bn k khai thc s c 
    178  ngha no .
    179 
    180 <p>
    181 Nu mt phn t cha bt k ni dung no, n c th cha cc phn t khc.  
    182 Tt c gi tr s c t thng qua thuc tnh, ch khng phi l d liu k t trong mt phn t.
    183 </p>
    184 
    185 <p>
    186 Cc phn t cng cp thng khng theo th t.  V d, cc phn t
    187 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>, 
    188 <code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code>, v 
    189 <code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code> 
    190 c th c trn ln vi nhau theo bt k trnh t no.  (Phn t 
    191 <code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>
    192 l trng hp ngoi l i vi quy tc ny:  N phi tun theo 
    193 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> 
    194 , i tng m n l b danh cho.)
    195 </p></dd>
    196 
    197 <dt><b>Thuc tnh</b></dt>
    198 <dd>Theo cch hiu thng thng, tt c thuc tnh u mang tnh ty chn.  Tuy nhin, c mt s thuc tnh 
    199 phi c quy nh cho mt phn t  hon thnh mc ch ca n.  S dng 
    200 ti liu lm hng dn.  i vi nhng thuc tnh thc s ty chn, n  cp ti mt gi tr
    201 mc nh hoc thng bo iu g s xy ra nu khng c mt c t.
    202 
    203 <p>Ngoi mt s thuc tnh ca phn t 
    204 <code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> 
    205 gc, tt c tn thuc tnh u bt u bng mt tin t {@code android:}&mdash; 
    206 v d, {@code android:alwaysRetainTaskState}.  Do tin t ny 
    207 ph dng, ti liu thng b st n khi tham chiu ti cc thuc tnh 
    208 theo tn.</p></dd>
    209 
    210 <dt><b>Khai bo tn lp</b></dt>
    211 <dd>Nhiu thuc tnh tng ng vi cc i tng Java, bao gm cc phn t cho 
    212 chnh ng dng (phn t 
    213 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
    214 ) v cc thnh phn chnh ca n &mdash; hot ng 
    215 (<code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>), 
    216 dch v 
    217 (<code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>), 
    218 hm nhn qung b 
    219 (<code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code>), 
    220 v trnh cung cp ni dung 
    221 (<code><a href="{@docRoot}guide/topics/manifest/provider-element.html">&lt;provider&gt;</a></code>).  
    222 
    223 <p>
    224 Nu bn nh ngha mt lp con nh vn lun lm i vi lp thnh phn 
    225 ({@link android.app.Activity}, {@link android.app.Service}, 
    226 {@link android.content.BroadcastReceiver}, v {@link android.content.ContentProvider}), 
    227 lp con s c khai bo thng qua mt thuc tnh {@code name}.  Tn phi bao gm 
    228 ch nh gi y .  
    229 V d, mt lp con {@link android.app.Service} c th c khai bo nh sau:
    230 </p>
    231 
    232 <pre>&lt;manifest . . . &gt;
    233     &lt;application . . . &gt;
    234         &lt;service android:name="com.example.project.SecretService" . . . &gt;
    235             . . .
    236         &lt;/service&gt;
    237         . . .
    238     &lt;/application&gt;
    239 &lt;/manifest&gt;</pre>
    240 
    241 <p>
    242 Tuy nhin, do cch vit tc k, nu k t u tin ca xu l mt du chm, 
    243 xu s c ni vi tn gi ca ng dng (nh c quy nh bi 
    244 thuc tnh ca phn t <code><a href="{@docRoot}guide/topics/manifest/manifest-element.html">&lt;manifest&gt;</a></code> 
    245 
    246 <code>, <a href="{@docRoot}guide/topics/manifest/manifest-element.html#package">package</a></code> 
    247 ).  Cch gn sau cng ging nh trn: 
    248 </p>
    249 
    250 <pre>&lt;manifest package="com.example.project" . . . &gt;
    251     &lt;application . . . &gt;
    252         &lt;service android:name=".SecretService" . . . &gt;
    253             . . .
    254         &lt;/service&gt;
    255         . . .
    256     &lt;/application&gt;
    257 &lt;/manifest&gt;</pre>
    258 
    259 <p>
    260 Khi khi ng mt thnh phn, Android s to mt thc th ca lp con c nu tn.  
    261 Nu lp con khng c quy nh, n s to mt thc th ca lp c s.
    262 </p></dd>
    263 
    264 <dt><b>Nhiu gi tr</b></dt>
    265 <dd>Nu c th quy nh nhiu hn mt gi tr, phn t gn nh lun 
    266 c lp li, thay v lit k nhiu gi tr trong mt phn t duy nht.  
    267 V d, mt b lc  nh c th lit k vi hnh ng:
    268 
    269 <pre>&lt;intent-filter . . . &gt;
    270     &lt;action android:name="android.intent.action.EDIT" /&gt;
    271     &lt;action android:name="android.intent.action.INSERT" /&gt;
    272     &lt;action android:name="android.intent.action.DELETE" /&gt;
    273     . . .
    274 &lt;/intent-filter&gt;</pre></dd>
    275 
    276 <dt><b>Gi tr ti nguyn</b></dt>
    277 <dd>Mt s thuc tnh c cc gi tr c th c hin th vi ngi dng &mdash; v 
    278 d, mt nhn v mt biu tng cho mt hot ng.  Gi tr ca nhng thuc tnh ny 
    279 cn c cc b ha v v th phi c thit t t mt ti nguyn hoc ch .  Gi tr 
    280 ti nguyn c biu din theo nh dng sau,</p>
    281 
    282 <p style="margin-left: 2em">{@code @[<i>gi</i>:]<i>kiu</i>:<i>tn</i>}</p>
    283 
    284 <p>
    285 trong  <i>gi</i> c th c b qua nu ti nguyn nm trong cng gi 
    286 vi ng dng, <i>kiu</i> l kiu ca ti nguyn &mdash; chng hn nh "xu" hoc 
    287 &mdash; "v c" v <i>tn</i> l tn nhn bit ti nguyn c th.  
    288 V d:
    289 </p>
    290 
    291 <pre>&lt;activity android:icon="@drawable/smallPic" . . . &gt</pre>
    292 
    293 <p>
    294 Cc gi tr t mt ch  c biu din theo cch tng t, nhng vi mt '{@code ?}' 
    295 thay v '{@code @}'  u:
    296 </p>
    297 
    298 <p style="margin-left: 2em">{@code ?[<i>gi</i>:]<i>kiu</i>:<i>tn</i>}
    299 </p></dd>
    300 
    301 <dt><b>Gi tr xu</b></dt>
    302 <dd>Trng hp gi tr ca mt thuc tnh l mt xu, phi s dng hai du xuyc ngc ('{@code \\}') 
    303  thot cc k t &mdash; v d, '{@code \\n}' i vi 
    304 mt dng tin tc hoc '{@code \\uxxxx}' i vi mt k t Unicode.</dd>
    305 </dl>
    306 
    307 
    308 <h2 id="filef">Cc Tnh nng Tp</h2>
    309 
    310 <p>
    311 Phn sau y m t cch phn nh mt s tnh nng ca Android 
    312 trong tp bn k khai.
    313 </p>
    314 
    315 
    316 <h3 id="ifs">B lc  nh</h3>
    317 
    318 <p>
    319 Cc thnh phn ct li ca mt ng dng (hot ng, dch v v hm nhn 
    320 qung b) c kch hot bi <i> nh</i>.   nh l mt 
    321 gi thng tin (mt i tng {@link android.content.Intent}) m t mt 
    322 hnh ng mong mun &mdash; bao gm d liu s c da trn, th loi ca 
    323 thnh phn m s thc hin hnh ng, v cc ch dn thch hp khc.  
    324 Android nh v mt thnh phn ph hp  hi p  nh, khi chy 
    325 mt thc th mi ca thnh phn nu cn, v chuyn cho n i tng  
    326  nh.
    327 </p>
    328 
    329 <p>
    330 Cc thnh phn s qung co kh nng ca mnh &mdash; cc kiu  nh m chng c th 
    331 hi p &mdash; thng qua <i>cc b lc  nh</i>.  Do h thng Android phi 
    332 tm hiu mt thnh phn c th x l nhng  nh no trc khi khi chy thnh phn , 
    333 b lc  nh c quy nh trong bn k khai nh l cc phn t 
    334 <code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code>
    335 .  Mt thnh phn c th c nhiu b lc, mi b lc li m t 
    336 mt kh nng khc nhau.
    337 </p>
    338 
    339 <p>
    340 Mt  nh m cng khai nu tn mt thnh phn mc tiu s kch hot thnh phn ;
    341 b lc khng c vai tr g  y.  Nhng mt  nh m khng quy nh mt mc tiu
    342 theo tn s ch c th kch hot thnh phn nu n c th chuyn qua mt trong cc b lc ca
    343 thnh phn.
    344 </p>
    345 
    346 <p>
    347  bit thng tin v cch cc i tng  nh c kim tra thng qua b lc  nh, 
    348 hy xem ti liu ring c tiu  
    349 <a href="{@docRoot}guide/components/intents-filters.html"> nh 
    350 v B lc  nh</a>.
    351 </p>
    352 
    353 
    354 <h3 id="iconlabel">Biu tng v Nhn</h3>
    355 
    356 <p>
    357 Nhiu phn t c thuc tnh {@code icon} v {@code label} cho mt 
    358 biu tng nh v nhn vn bn m c th c hin th vi ngi dng.  Mt s cng c thuc tnh 
    359 {@code description} cho vn bn gii trnh di hn m cng c th 
    360 c hin th trn mn hnh.  V d, phn t 
    361 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    362 c c ba thuc tnh ny, v th khi ngi dng c hi xem c 
    363 cp quyn cho mt ng dng yu cu hay khng, biu tng th hin 
    364 quyn, tn ca quyn, v m t ni dung
    365 ca quyn  u c th c trnh by cho ngi dng xem.
    366 </p>
    367 
    368 <p>
    369 Trong mi trng hp, biu tng v nhn c t trong mt phn t cha s tr thnh cc thit t 
    370 {@code icon} v {@code label} mc nh cho tt c phn t con ca b cha .  
    371 V th, biu tng v nhn c t trong phn t 
    372 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
    373 l biu tng v nhn mc nh cho tng thnh phn ca ng dng.  
    374 Tng t, biu tng v nhn c t cho mt thnh phn &mdash; v d, mt phn t 
    375 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code> 
    376 &mdash; s l cc ci t mc nh cho tng phn t 
    377 <code><a href="{@docRoot}guide/topics/manifest/intent-filter-element.html">&lt;intent-filter&gt;</a></code> 
    378 ca thnh phn .  Nu mt phn t
    379 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> 
    380 thit t mt nhn, nhng hot ng v b lc  nh ca n th khng, 
    381 nhn ng dng s c coi l nhn ca c hot ng v 
    382 b lc  nh.
    383 </p>
    384 
    385 <p>
    386 Biu tng v nhn c t cho mt b lc  nh s c s dng  biu din mt thnh phn 
    387 bt c khi no thnh phn  c trnh by vi ngi dng  thc hin chc nng
    388 m b lc  qung co.  V d, mt b lc vi cc thit t 
    389 "{@code android.intent.action.MAIN}" v 
    390 "{@code android.intent.category.LAUNCHER}" qung co mt hot ng 
    391 l hot ng khi u mt ng dng &mdash; c th, l
    392 hot ng s c hin th trong trnh khi chy ng dng.  V th, biu tng v nhn 
    393 c t trong b lc l nhng ni dung c hin th trong trnh khi chy.
    394 </p>
    395 
    396 
    397 <h3 id="perms">Quyn</h3>
    398 
    399 <p>
    400 Mt <i>quyn</i> l s hn ch gii hn truy cp vo mt phn ca m 
    401 hoc vo d liu trn thit b.   Gii hn ny c p t nhm bo v d liu 
    402 v m trng yu, c th b lm dng  bp mo hoc lm hng tri nghim ngi dng.  
    403 </p>
    404 
    405 <p>
    406 Mi quyn c nhn bit bng mt nhn duy nht.  Thng thng, nhn cho bit 
    407 hnh ng b hn ch.  V d, sau y l mt s quyn c nh ngha 
    408 bi Android:
    409 </p>
    410 
    411 <p style="margin-left: 2em">{@code android.permission.CALL_EMERGENCY_NUMBERS}
    412 <br/>{@code android.permission.READ_OWNER_DATA}
    413 <br/>{@code android.permission.SET_WALLPAPER}
    414 <br/>{@code android.permission.DEVICE_POWER}</p>
    415 
    416 <p>
    417 Mt tnh nng c th c bo v bi nhiu nht mt quyn.
    418 </p>
    419 
    420 <p>
    421 Nu mt ng dng cn truy cp vo mt tnh nng c bo v bi mt quyn, 
    422 n phi khai bo rng n yu cu quyn  cng vi mt phn t 
    423 <code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code> 
    424 trong bn k khai.  Lc , khi ng dng c ci t trn 
    425 thit b, trnh ci t s xc nh xem c cp quyn 
    426 c yu cu hay khng bng cch kim tra cc thm quyn  k chng ch 
    427 ca ng dng v trong mt s trng hp, bng cch hi ngi dng.  
    428 Nu quyn c cp, ng dng c th s dng cc tnh nng 
    429 c bo v.  Nu khng, vic th truy cp nhng tnh nng  s tht bi
    430 m khng c bt k thng bo no cho ngi dng. 
    431 </p>
    432 
    433 <p>
    434 Mt ng dng cng c th bo v cc thnh phn ca chnh n (hot ng, dch v, 
    435 hm nhn qung b v trnh cung cp ni dung) bng cc quyn.  N c th s dng 
    436 bt k quyn no c nh ngha bi Android (c lit k trong 
    437 {@link android.Manifest.permission android.Manifest.permission}) hoc c khai bo 
    438 bi cc ng dng khc.  Hoc n c th t nh ngha quyn ca mnh.  Mt quyn mi c khai bo 
    439 bng phn t 
    440 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    441 .  V d, mt hot ng c th c bo v nh sau:
    442 </p>
    443 
    444 <pre>
    445 &lt;manifest . . . &gt;
    446     &lt;permission android:name="com.example.project.DEBIT_ACCT" . . . /&gt;
    447     &lt;uses-permission android:name="com.example.project.DEBIT_ACCT" /&gt;
    448     . . .
    449     &lt;application . . .&gt;
    450         &lt;activity android:name="com.example.project.FreneticActivity"
    451                   android:permission="com.example.project.DEBIT_ACCT"
    452                   . . . &gt;
    453             . . .
    454         &lt;/activity&gt;
    455     &lt;/application&gt;
    456 &lt;/manifest&gt;
    457 </pre>
    458 
    459 <p>
    460 Lu  rng trong v d ny, quyn {@code DEBIT_ACCT} khng ch 
    461 c khai bo bng phn t 
    462 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    463 , vic s dng quyn cng c yu cu bng phn t 
    464 <code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code> 
    465 .  Phi yu cu s dng quyn  cc thnh phn khc ca 
    466 ng dng nhm khi chy hot ng c bo v, mc d vic bo v 
    467 do chnh ng dng p t.  
    468 </p>
    469 
    470 <p>
    471 Trong cng v d ny, nu thuc tnh {@code permission} c t thnh mt quyn 
    472 c khai bo  ni khc 
    473 (chng hn nh {@code android.permission.CALL_EMERGENCY_NUMBERS}, s khng 
    474 cn phi khai bo li n bng mt phn t 
    475 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code>
    476 .  Tuy nhin, s vn cn phi yu cu s dng n bng 
    477 <code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code>. 
    478 </p>
    479 
    480 <p>
    481 Phn t 
    482 <code><a href="{@docRoot}guide/topics/manifest/permission-tree-element.html">&lt;permission-tree&gt;</a></code> 
    483 s khai bo mt vng tn cho nhm quyn m s c nh ngha trong 
    484 m.  V 
    485 <code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></code>
    486 s nh ngha mt nhn cho mt tp hp quyn (c c khai bo trong bn k khai bng phn t 
    487 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code> 
    488 v c khai bo  ch khc).  N ch nh hng ti cch cc quyn c 
    489 nhm li khi c trnh by vi ngi dng.  Phn t 
    490 <code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></code>
    491 khng quy nh nhng quyn no thuc v nhm; 
    492 n ch t cho nhm mt ci tn.  Mt quyn c t vo nhm
    493 bng cch gn tn nhm vi thuc tnh ca phn t
    494 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html">&lt;permission&gt;</a></code> 
    495 , 
    496 <code><a href="{@docRoot}guide/topics/manifest/permission-element.html#pgroup">permissionGroup</a></code> 
    497 .
    498 </p>
    499 
    500 
    501 <h3 id="libs">Th vin</h3>
    502 
    503 <p>
    504 Mi ng dng u c lin kt vi th vin Android mc nh, n 
    505 bao gm cc gi c bn  xy dng ng dng (bng cc lp thng dng 
    506 chng hn nh Hot ng, Dch v,  nh, Dng xem, Nt, ng dng, Trnh cung cp Ni dung, 
    507 v.v.).
    508 </p>
    509 
    510 <p>
    511 Tuy nhin, mt s gi nm trong th vin ca chnh mnh.  Nu ng dng ca bn 
    512 s dng m t bt k gi no trong nhng gi ny, n phi cng khai yu cu c lin kt 
    513 vi chng.  Bn k khai phi cha mt phn t 
    514 <code><a href="{@docRoot}guide/topics/manifest/uses-library-element.html">&lt;uses-library&gt;</a></code> 
    515 ring  t tn cho tng th vin.  (Tn th vin c th c tm thy trong ti liu 
    516 ca gi.)
    517 </p>
    518