- syntax:
<intent-filter android:icon="drawable resource" android:label="string resource" android:priority="integer" > ... </intent-filter>
- contenuti in:
<activity>
<activity-alias>
<service>
<receiver>
<provider>
- Deve contenere:
<action>
- può contenere:
<category>
<data>
<uri-relative-filter-group>
- description:
- Specifica i tipi di intent a cui può rispondere un'attività, un servizio o un ricevitore di trasmissione. Un filtro per intent dichiara le funzionalità del suo componente principale: cosa può fare un'attività o un servizio e quali tipi di trasmissioni può gestire un ricevitore.
Il componente viene aperto per ricevere intent del tipo pubblicizzato, escludendo quelli non significativi per il componente. La maggior parte dei contenuti del filtro è descritta dai relativi elementi secondari:
Per una discussione più dettagliata sui filtri, consulta la sezione Intent e filtri per intent e la sezione Filtri per intent nella panoramica del manifest dell'app.
- attributes:
android:icon
- Un'icona che rappresenta l'attività, il servizio o il ricevitore di trasmissione principale quando questo componente viene presentato all'utente come dotato della funzionalità descritta dal filtro.
Questo attributo viene impostato come riferimento a una risorsa drawable contenente la definizione dell'immagine. Il valore predefinito è l'icona impostata dall'attributo
icon
del componente principale. Se l'elemento principale non specifica un'icona, il valore predefinito è l'icona impostata dall'elemento<application>
.Per saperne di più sulle icone dei filtri di intent, consulta la sezione Icone ed etichette nella panoramica del file manifest dell'app.
android:label
- Un'etichetta leggibile dall'utente per il componente principale. Questa etichetta, anziché quella impostata dal componente principale, viene utilizzata quando il componente viene presentato all'utente come dotato della funzionalità descritta dal filtro.
L'etichetta viene impostata come riferimento a una risorsa stringa in modo che possa essere localizzata come le altre stringhe nell'interfaccia utente. Tuttavia, per praticità durante lo sviluppo dell'applicazione, puoi impostarlo anche come stringa non elaborata.
Il valore predefinito è l'etichetta impostata dal componente principale. Se l'elemento primario non specifica un'etichetta, il valore predefinito è l'etichetta impostata dall'attributo
label
dell'elemento<application>
.Per saperne di più sulle etichette dei filtri di intent, consulta la sezione Icone ed etichette nella panoramica del file manifest dell'app.
android:priority
- La priorità assegnata al componente principale per quanto riguarda la gestione degli intent del tipo descritto dal filtro. Questo attributo ha un significato sia per le attività sia per i ricevitori di trasmissione.
- Fornisce informazioni sulla capacità di un'attività di rispondere a un intento corrispondente al filtro rispetto ad altre attività che possono anche rispondere all'intento. Quando un'intent può essere gestita da più attività con priorità diverse, Android considera come potenziali target per l'intent solo quelle con valori di priorità più elevati.
Controlla l'ordine in cui vengono eseguiti i ricevitori di trasmissione per ricevere i messaggi di trasmissione, con quelli che hanno valori di priorità più elevati che vengono chiamati prima di quelli con valori più bassi. L'ordine si applica solo ai messaggi sincroni. Viene ignorato per i messaggi asincroni.
Utilizza questo attributo solo se devi imporre un ordine specifico in cui vengono ricevute le trasmissioni o se vuoi forzare Android a preferire un'attività rispetto alle altre.
Il valore è un numero intero, ad esempio
100
. I numeri più elevati hanno una priorità maggiore. Il valore predefinito è0
.In alcuni casi, la priorità richiesta viene ignorata e il valore viene limitato a
0
. Ciò si verifica quando:- Un'applicazione non privilegiata richiede una priorità maggiore o uguale a 0.
- Un'applicazione privilegiata richiede una priorità > 0 per
ACTION_VIEW
,ACTION_SEND
,ACTION_SENDTO
oACTION_SEND_MULTIPLE
.
Per ulteriori informazioni, vedi
setPriority()
. android:order
L'ordine in cui viene elaborato il filtro quando più filtri corrispondono.
order
è diverso dapriority
in quantopriority
si applica su più app, mentreorder
risolve i dubbi relativi a più filtri di corrispondenza in un'unica app.Quando più filtri possono corrispondere, utilizza un'intenzione diretta.
Il valore è un numero intero, ad esempio
100
. I numeri più alti vengono associati per primi. Il valore predefinito è0
.Questo attributo è stato introdotto nel livello API 28.
android:autoVerify
- Se Android deve verificare che il file JSON Digital Asset Links dell'host specificato corrisponda a questa applicazione.
Per ulteriori informazioni, consulta Verificare Android App Links.
Il valore predefinito è
false
.Questo attributo è stato introdotto nel livello API 23.
- introdotto in:
- Livello API 1
- Vedi anche:
<action>
<category>
<data>
<uri-relative-filter-group>
<filtro-intent>
I campioni di contenuti e codice in questa pagina sono soggetti alle licenze descritte nella Licenza per i contenuti. Java e OpenJDK sono marchi o marchi registrati di Oracle e/o delle sue società consociate.
Ultimo aggiornamento 2025-07-27 UTC.
[null,null,["Ultimo aggiornamento 2025-07-27 UTC."],[],[],null,["# <intent-filter\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cintent-filter android:icon=\"drawable resource\"\n android:label=\"string resource\"\n android:priority=\"integer\" \u003e\n ...\n \u003c/intent-filter\u003e\n ```\n\ncontained in:\n: [\u003cactivity\u003e](/guide/topics/manifest/activity-element)\n\n [\u003cactivity-alias\u003e](/guide/topics/manifest/activity-alias-element)\n\n [\u003cservice\u003e](/guide/topics/manifest/service-element)\n\n [\u003creceiver\u003e](/guide/topics/manifest/receiver-element)\n\n [\u003cprovider\u003e](/guide/topics/manifest/provider-element)\n\nmust contain:\n: [\u003caction\u003e](/guide/topics/manifest/action-element)\n\ncan contain:\n: [\u003ccategory\u003e](/guide/topics/manifest/category-element)\n\n [\u003cdata\u003e](/guide/topics/manifest/data-element)\n\n [\u003curi-relative-filter-group\u003e](/guide/topics/manifest/uri-relative-filter-group-element)\n\ndescription:\n\n: 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.\u003cbr /\u003e\n\n It opens the component to receiving\n intents of the advertised type while filtering out those that aren't\n meaningful for the component.\n Most of the contents of the filter are described by its subelements:\n\n - [\u003caction\u003e](/guide/topics/manifest/action-element),\n - [\u003ccategory\u003e](/guide/topics/manifest/category-element),\n - [\u003cdata\u003e](/guide/topics/manifest/data-element), and\n - [\u003curi-relative-filter-group\u003e](/guide/topics/manifest/uri-relative-filter-group-element).\n\n \u003cbr /\u003e\n\n\n For a more detailed discussion of filters, see\n [Intents\n and Intent Filters](/guide/components/intents-filters) and the\n [Intent filters](/guide/topics/manifest/manifest-intro#ifs)\n section in the app manifest overview.\n\nattributes:\n:\n\n `android:icon`\n\n : 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.\u003cbr /\u003e\n\n\n This attribute is set as a reference to a drawable resource\n containing the image definition. The default value is the icon set\n by the parent component's `icon` attribute. If the parent\n doesn't specify an icon, the default is the icon set by the\n [\u003capplication\u003e](/guide/topics/manifest/application-element) element.\n\n\n For more information about intent filter icons, see the\n [Icons and labels](/guide/topics/manifest/manifest-intro#iconlabel)\n section in the app manifest overview.\n\n `android:label`\n\n : 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.\u003cbr /\u003e\n\n\n The label is set as a reference to a string resource so that\n it can be localized like other strings in the user interface.\n However, as a convenience while you're developing the application,\n it can also be set as a raw string.\n\n\n The default value is the label set by the parent component. If the\n parent doesn't specify a label, the default is the label set by the\n [\u003capplication\u003e](/guide/topics/manifest/application-element) element's\n [label](/guide/topics/manifest/application-element#label) attribute.\n\n\n For more information about intent filter labels, see the\n [Icons and labels](/guide/topics/manifest/manifest-intro#iconlabel)\n section in the app manifest overview.\n\n `android:priority`\n : The priority given to the parent component with regard\n to handling intents of the type described by the filter. This attribute has\n meaning for both activities and broadcast receivers.\n\n - It provides information about how able an activity is to respond to an intent that matches the filter, relative to other activities that can also respond to the intent. When an intent can be handled by multiple activities with different priorities, Android considers only those with higher priority values as potential targets for the intent.\n - It controls the order in which broadcast receivers are executed to\n receive broadcast messages, with those having higher priority\n values being called before those having lower values. The order applies only\n to synchronous messages. It's ignored for asynchronous messages.\n\n\n Use this attribute only if you need to impose a specific order in\n which the broadcasts are received or want to force Android to prefer\n one activity over others.\n\n\n The value is an integer, such as `100`. Higher numbers have a\n higher priority. The default value is `0`.\n\n\n In certain circumstances the requested priority is ignored and the value\n is capped to `0`. This occurs when:\n\n - A non-privileged application requests any priority \\\u003e0.\n - A privileged application requests a priority \\\u003e0 for [ACTION_VIEW](/reference/android/content/Intent#ACTION_VIEW), [ACTION_SEND](/reference/android/content/Intent#ACTION_SEND), [ACTION_SENDTO](/reference/android/content/Intent#ACTION_SENDTO) or [ACTION_SEND_MULTIPLE](/reference/android/content/Intent#ACTION_SEND_MULTIPLE).\n\n\n For more information, see [setPriority()](/reference/android/content/IntentFilter#setPriority(int)).\n\n `android:order`\n\n : The order in which the filter is processed when multiple filters match.\n\n `order` differs from `priority` in that `priority` applies\n across apps, while `order` disambiguates multiple matching filters in a single\n app.\n\n When multiple filters can match, use a directed intent instead.\n\n The value is an integer, such as `100`. Higher numbers are matched first.\n The default value is `0`.\n\n This attribute was introduced in API level 28.\n\n `android:autoVerify`\n : Whether Android needs to verify that the Digital Asset Links JSON file from the specified\n host matches this application.\n\nintroduced in:\n: API level 1\n\nsee also:\n: [\u003caction\u003e](/guide/topics/manifest/action-element)\n\n [\u003ccategory\u003e](/guide/topics/manifest/category-element)\n\n [\u003cdata\u003e](/guide/topics/manifest/data-element)\n\n [\u003curi-relative-filter-group\u003e](/guide/topics/manifest/uri-relative-filter-group-element)"]]