pub struct IntentFilter {
    pub icon: Option<MipmapOrDrawableResource>,
    pub label: Option<StringResourceOrString>,
    pub priority: Option<u32>,
    pub order: Option<u32>,
    pub action: Vec<Action>,
    pub category: Vec<Category>,
    pub data: Vec<Data>,
    pub auto_verify: Option<bool>,
}
Expand description

Specifies the types of intents that an activity, service, or broadcast receiver can respond to.

An intent filter declares the capabilities of its parent component — what an activity or service can do and what types of broadcasts a receiver can handle. It opens the component to receiving intents of the advertised type, while filtering out those that are not meaningful for the component. Most of the contents of the filter are described by its <action>, <category>, and <data> subelements.

For a more detailed discussion of filters, see the separate Intents and Intent Filters document, as well as the Intents Filters section in the introduction.

XML Syntax

<intent-filter android:icon="drawable resource"
               android:label="string resource"
               android:priority="integer" >
    ...
</intent-filter>

Contained in

Must contain

Can contain

Introduced in

API Level 1

Fields§

§icon: Option<MipmapOrDrawableResource>

An icon that represents the parent activity, service, or broadcast receiver when that component is presented to the user as having the capability described by the filter.

This attribute must be set as a reference to a drawable resource containing the image definition. The default value is the icon set by the parent component’s icon attribute. If the parent does not specify an icon, the default is the icon set by the <application> element.

For more on intent filter icons, see Icons and Labels in the introduction.

§label: Option<StringResourceOrString>

A user-readable label for the parent component. This label, rather than the one set by the parent component, is used when the component is presented to the user as having the capability described by the filter. The label should be set as a reference to a string resource, so that it can be localized like other strings in the user interface. However, as a convenience while you’re developing the application, it can also be set as a raw string.

The default value is the label set by the parent component. If the parent does not specify a label, the default is the label set by the <application> element’s label attribute.s

For more on intent filter labels, see Icons and Labels in the introduction.

§priority: Option<u32>

The priority that should be given to the parent component with regard to handling intents of the type described by the filter. This attribute has meaning for both activities and broadcast receivers:

  • It provides information about how able an activity is to respond to an intent that matches the filter, relative to other activities that could also respond to the intent. When an intent could be handled by multiple activities with different priorities, Android will consider only those with higher priority values as potential targets for the intent.
  • It controls the order in which broadcast receivers are executed to receive broadcast messages. Those with higher priority values are called before those with lower values. (The order applies only to synchronous messages; it’s ignored for asynchronous messages.)

Use this attribute only if you really need to impose a specific order in which the broadcasts are received, or want to force Android to prefer one activity over others. The value must be an integer, such as “100”. Higher numbers have a higher priority. The default value is 0 In certain circumstances the requested priority is ignored and the value is capped to 0. This occurs when:

Also see setPriority().

§order: Option<u32>

The order in which the filter should be processed when multiple filters match. order differs from priority in that priority applies across apps, while order disambiguates multiple matching filters in a single app.

When multiple filters could match, use a directed intent instead.

The value must be an integer, such as “100”. Higher numbers are matched first. The default value is 0.

This attribute was introduced in API Level 28.

§action: Vec<Action>

List of <action> tags.

§category: Vec<Category>

List of <category> tags.

§data: Vec<Data>

List of <data> tags.

§auto_verify: Option<bool>

This attribute signals to the system that it should verify whether your app belongs to the URL domains used in your intent filters.

See verify-android-applinks for more information.

Trait Implementations§

source§

impl Clone for IntentFilter

source§

fn clone(&self) -> IntentFilter

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for IntentFilter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for IntentFilter

source§

fn default() -> IntentFilter

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for IntentFilter

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl PartialEq<IntentFilter> for IntentFilter

source§

fn eq(&self, other: &IntentFilter) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for IntentFilter

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl YaDeserialize for IntentFilter

source§

fn deserialize<R: Read>(reader: &mut Deserializer<R>) -> Result<Self, String>

source§

impl YaSerialize for IntentFilter

source§

fn serialize<W: Write>(&self, writer: &mut Serializer<W>) -> Result<(), String>

source§

fn serialize_attributes( &self, source_attributes: Vec<OwnedAttribute>, source_namespace: Namespace ) -> Result<(Vec<OwnedAttribute>, Namespace), String>

source§

impl Eq for IntentFilter

source§

impl StructuralEq for IntentFilter

source§

impl StructuralPartialEq for IntentFilter

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,