Home | History | Annotate | Download | only in manifest
      1 page.title=<intent-filter>
      2 parent.title=The AndroidManifest.xml File
      3 parent.link=manifest-intro.html
      4 @jd:body
      5 
      6 <dl class="xml">
      7 <dt>syntax:</dt>
      8 <dd><pre class="stx">&lt;intent-filter android:<a href="#icon">icon</a>="<i>drawable resource</i>"
      9                android:<a href="#label">label</a>="<i>string resource</i>"
     10                android:<a href="#priority">priority</a>="<i>integer</i>" &gt;
     11     . . .
     12 &lt;/intent-filter&gt;</pre></dd>
     13 
     14 <dt>contained in:</dt>
     15 <dd><code><a href="{@docRoot}guide/topics/manifest/activity-element.html">&lt;activity&gt;</a></code>
     16 <br/><code><a href="{@docRoot}guide/topics/manifest/activity-alias-element.html">&lt;activity-alias&gt;</a></code>
     17 <br/><code><a href="{@docRoot}guide/topics/manifest/service-element.html">&lt;service&gt;</a></code>
     18 <br/><code><a href="{@docRoot}guide/topics/manifest/receiver-element.html">&lt;receiver&gt;</a></code></dd>
     19 
     20 <dt>must contain:</dt>
     21 <dd><code><a href="{@docRoot}guide/topics/manifest/action-element.html">&lt;action&gt;</a></code></dd>
     22 
     23 <dt>can contain:</dt>
     24 <dd><code><a href="{@docRoot}guide/topics/manifest/category-element.html">&lt;category&gt;</a></code>
     25 <br/><code><a href="{@docRoot}guide/topics/manifest/data-element.html">&lt;data&gt;</a></code></dd>
     26 
     27 <dt>description:</dt>
     28 <dd>Specifies the types of intents that an activity, service, or broadcast 
     29 receiver can respond to.  An intent filter declares the capabilities of its
     30 parent component &mdash; what an activity or service can do and what types 
     31 of broadcasts a receiver can handle.  It opens the component to receiving 
     32 intents of the advertised type, while filtering out those that are not 
     33 meaningful for the component.
     34 
     35 <p>
     36 Most of the contents of the filter are described by its 
     37 <code><a href="{@docRoot}guide/topics/manifest/action-element.html">&lt;action&gt;</a></code>, 
     38 <code><a href="{@docRoot}guide/topics/manifest/category-element.html">&lt;category&gt;</a></code>, and
     39 <code><a href="{@docRoot}guide/topics/manifest/data-element.html">&lt;data&gt;</a></code> subelements.
     40 </p>
     41 
     42 <p>
     43 For a more detailed discussion of filters, see the separate  
     44 <a href="{@docRoot}guide/components/intents-filters.html">Intents 
     45 and Intent Filters</a> document, as well as the 
     46 <a href="{@docRoot}guide/topics/manifest/manifest-intro.html#ifs">Intents Filters</a> 
     47 section in the introduction.
     48 </p></dd>
     49 
     50 <dt>attributes:</dt>
     51 <dd><dl class="attr">
     52 <dt><a name="icon"></a>{@code android:icon}</dt>
     53 <dd>An icon that represents the parent activity, service, or broadcast
     54 receiver when that component is presented to the user as having the 
     55 capability described by the filter.
     56 
     57 <p>
     58 This attribute must be set as a reference to a drawable resource 
     59 containing the image definition.  The default value is the icon set 
     60 by the parent component's {@code icon} attribute.  If the parent 
     61 does not specify an icon, the default is the icon set by the
     62 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element.
     63 </p>
     64 
     65 <p>
     66 For more on intent filter icons, see 
     67 <a href="{@docRoot}guide/topics/manifest/manifest-intro.html#iconlabel">Icons and Labels</a>
     68 in the introduction.
     69 </p></dd>
     70 
     71 <dt><a name="label"></a>{@code android:label}</dt>
     72 <dd>A user-readable label for the parent component.  This label, rather than
     73 the one set by the parent component, is used when the component is presented
     74 to the user as having the capability described by the filter.
     75 
     76 <p>
     77 The label should be set as a reference to a string resource, so that
     78 it can be localized like other strings in the user interface.  
     79 However, as a convenience while you're developing the application, 
     80 it can also be set as a raw string.
     81 </p>
     82 
     83 <p>
     84 The default value is the label set by the parent component.  If the 
     85 parent does not specify a label, the default is the label set by the
     86 <code><a href="{@docRoot}guide/topics/manifest/application-element.html">&lt;application&gt;</a></code> element's 
     87 <code><a href="{@docRoot}guide/topics/manifest/application-element.html#label"> label</a></code> attribute.
     88 </p>
     89 
     90 <p>
     91 For more on intent filter labels, see 
     92 <a href="{@docRoot}guide/topics/manifest/manifest-intro.html#iconlabel">Icons and Labels</a>
     93 in the introduction.
     94 </p></dd>
     95 
     96 <dt><a name="priority"></a>{@code android:priority}</dt>
     97 <dd>The priority that should be given to the parent component with regard
     98 to handling intents of the type described by the filter.  This attribute has 
     99 meaning for both activities and broadcast receivers:
    100 
    101 <ul>
    102 <li>It provides information about how able an activity is to respond to 
    103 an intent that matches the filter, relative to other activities that could
    104 also respond to the intent.  When an intent could be handled by multiple 
    105 activities with different priorities, Android will consider only those with
    106 higher priority values as potential targets for the intent.</li>
    107 
    108 <li><p>It controls the order in which broadcast receivers are executed to
    109 receive broadcast messages.  Those with higher priority 
    110 values are called before those with lower values.  (The order applies only 
    111 to synchronous messages; it's ignored for asynchronous messages.)</p></li>
    112 </ul>
    113 
    114 <p>
    115 Use this attribute only if you really need to impose a specific order in 
    116 which the broadcasts are received, or want to force Android to prefer
    117 one activity over others.
    118 </p>
    119 
    120 <p>
    121 The value must be an integer, such as "{@code 100}".  Higher numbers have a
    122 higher priority. The default value is 0.
    123 The value must be greater than -1000 and less than 1000.</p>
    124 
    125 <p>Also see {@link android.content.IntentFilter#setPriority
    126 setPriority()}.
    127 </p></dd>
    128 
    129 </dl></dd>
    130 
    131 <!-- ##api level indication## -->
    132 <dt>introduced in:</dt>
    133 <dd>API Level 1</dd>
    134 
    135 <dt>see also:</dt>
    136 <dd><code><a href="{@docRoot}guide/topics/manifest/action-element.html">&lt;action&gt;</a></code>
    137 <br/><code><a href="{@docRoot}guide/topics/manifest/category-element.html">&lt;category&gt;</a></code>
    138 <br/><code><a href="{@docRoot}guide/topics/manifest/data-element.html">&lt;data&gt;</a></code></dd>
    139 
    140 </dl>
    141