- składnia:
<intent-filter android:icon="drawable resource" android:label="string resource" android:priority="integer" > ... </intent-filter>
- zawarte w:
<activity>
<activity-alias>
<service>
<receiver>
<provider>
- musi zawierać:
<action>
- może zawierać:
<category>
<data>
<uri-relative-filter-group>
- description:
- Określa typy intencji, na które może odpowiadać odbiorca aktywności, usługi lub transmisji. Filtr intencji określa możliwości swojego komponentu nadrzędnego: jakie działania może wykonywać aktywność lub usługa oraz jakie typy transmisji może odbierać odbiornik.
Otwiera ona komponent na działanie intencje o reklamowanym typie, odfiltrowując te, które nie są dla niego istotne. Większość elementów filtra jest opisana przez jego podelementy:
Więcej informacji o filtrach znajdziesz w artykule Intencje i filtry intencji oraz w sekcji Filtry intencji w omówieniu pliku manifestu aplikacji.
- atrybuty:
android:icon
- Ikona reprezentująca nadrzędną aktywność, usługę lub odbiornik transmisji, gdy komponent jest przedstawiany użytkownikowi jako posiadający możliwości opisane przez filtr.
Ten atrybut jest ustawiany jako odwołanie do zasobów do rysowania zawierających definicję obrazu. Wartość domyślna to ikona ustawiona przez atrybut
icon
komponentu nadrzędnego. Jeśli jednostka nadrzędna nie określa ikony, domyślnie jest używana ikona ustawiona w elemencie<application>
.Więcej informacji o ikonach filtra intencji znajdziesz w sekcji Ikony i etykiety w omówieniu pliku manifestu aplikacji.
android:label
- Etykieta komponentu nadrzędnego zrozumiała dla użytkownika. Ta etykieta, a nie ta ustawiona przez komponent nadrzędny, jest używana, gdy komponent jest prezentowany użytkownikowi jako element o możliwościach opisanych przez filtr.
Etykieta jest ustawiana jako odwołanie do zasobu ciągu znaków, aby można ją było zlokalizować tak jak inne ciągi znaków w interfejsie użytkownika. Jednak na potrzeby wygody podczas tworzenia aplikacji można go też ustawić jako ciąg znaków.
Wartość domyślna to etykieta ustawiona przez komponent nadrzędny. Jeśli rodzic nie określa etykiety, domyślnie jest używana etykieta ustawiona w atrybucie elementu
<application>
.label
Więcej informacji o etykietach filtra intencji znajdziesz w sekcji Ikony i etykiety w omówieniu pliku manifestu aplikacji.
android:priority
- Priorytet nadany komponentowi nadrzędnemu w odniesieniu do obsługi intencji typu opisanego przez filtr. Ten atrybut ma znaczenie zarówno w przypadku aktywności, jak i odbiorników transmisji.
- Zawiera on informacje o tym, jak dana aktywność reaguje na intencję pasującą do filtra w porównaniu z innymi aktywnościami, które również mogą odpowiadać tej intencji. Gdy intencję może obsłużyć wiele aktywności o różnych priorytetach, Android jako potencjalne docelowe traktuje tylko te o wyższych wartościach priorytetu.
Określa on kolejność, w jakiej odbiorniki transmisji są wywoływane do odbierania wiadomości. Odbiorniki o większych wartościach priorytetu są wywoływane przed odbiornikami o mniejszych wartościach. Kolejność ma zastosowanie tylko do wiadomości synchronicznych. Jest on ignorowany w przypadku wiadomości asynchronicznych.
Używaj tego atrybutu tylko wtedy, gdy chcesz narzucić określony porządek odbierania transmisji lub chcesz zmusić Androida do preferowania jednej aktywności nad innymi.
Wartość jest liczbą całkowitą, np.
100
. Im wyższa liczba, tym wyższy priorytet. Wartością domyślną jest0
.W pewnych okolicznościach żądany priorytet jest ignorowany, a wartość jest ograniczona do
0
. Dzieje się tak, gdy:- Aplikacja bez uprawnień prosi o dowolny priorytet >0.
- Aplikacja z przywilejami prosi o priorytet >0 w przypadku
ACTION_VIEW
,ACTION_SEND
,ACTION_SENDTO
lubACTION_SEND_MULTIPLE
.
Więcej informacji znajdziesz w artykule
setPriority()
. android:order
Kolejność, w jakiej filtr jest przetwarzany, gdy pasuje więcej niż 1 filtr.
order
różni się odpriority
tym, żepriority
ma zastosowanie w różnych aplikacjach, aorder
rozstrzyga niejednoznaczność w przypadku wielu pasujących filtrów w jednej aplikacji.Jeśli dopasowanie może być spełnione przez wiele filtrów, użyj zamiast tego kierowanego zamiaru.
Wartość jest liczbą całkowitą, np.
100
. Dopasowania z wyższymi wartościami są sprawdzane jako pierwsze. Wartością domyślną jest0
.Ten atrybut został wprowadzony na poziomie interfejsu API 28.
android:autoVerify
- Czy Android musi zweryfikować, czy plik JSON protokołu Digital Asset Links z wybranego hosta pasuje do tej aplikacji.
Więcej informacji znajdziesz w artykule Weryfikowanie linków aplikacji na Androida.
Wartość domyślna to
false
.Ten atrybut został wprowadzony w poziomie interfejsu API 23.
- wprowadzona w:
- Poziom API 1
- Zobacz też:
<action>
<category>
<data>
<uri-relative-filter-group>
<intent-filter>
Treść strony i umieszczone na niej fragmenty kodu podlegają licencjom opisanym w Licencji na treści. Java i OpenJDK są znakami towarowymi lub zastrzeżonymi znakami towarowymi należącymi do firmy Oracle lub jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-27 UTC.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 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)"]]