- תחביר:
<intent-filter android:icon="drawable resource" android:label="string resource" android:priority="integer" > ... </intent-filter>
- נכללים ב:
<activity>
<activity-alias>
<service>
<receiver>
<provider>
- חייב לכלול:
<action>
- יכול להכיל:
<category>
<data>
<uri-relative-filter-group>
- description:
- מציין את סוגי הכוונות שפעילות, שירות או מקלט שידור יכולים להגיב עליהן. מסנן Intent מצהיר על היכולות של רכיב ההורה שלו: מה פעילות או שירות יכולים לעשות ואילו סוגים של שידורים מקלט יכול לטפל בהם.
הוא פותח את הרכיב לקבלת כוונות מהסוג שפורסם, וסינון של כוונות שלא רלוונטיות לרכיב. רוב התוכן של המסנן מתואר על ידי רכיבי המשנה שלו:
לדיון מפורט יותר על מסננים, קראו את הקטע כוונות ומסנני כוונות ואת הקטע מסנני כוונות בסקירה הכללית על קובץ המניפסט של האפליקציה.
- מאפיינים:
android:icon
- סמל שמייצג את הפעילות, השירות או מקלט השידור של ההורה, כשהרכיב הזה מוצג למשתמש ככזה שיש לו את היכולת שמתוארת על ידי המסנן.
המאפיין הזה מוגדר כהפניה למשאב שאפשר לצייר שמכיל את הגדרת התמונה. ערך ברירת המחדל הוא הסמל שהוגדר על ידי המאפיין
icon
של רכיב ההורה. אם לא מציינים סמל ברמת ההורה, ברירת המחדל היא הסמל שמוגדר על ידי הרכיב<application>
.מידע נוסף על סמלי מסנני הכוונה זמין בקטע סמלים ותוויות בסקירה הכללית על קובץ המניפסט של האפליקציה.
android:label
- תווית שקריאה למשתמש עבור הרכיב ההורה. התווית הזו, ולא התווית שמוגדרת על ידי רכיב ההורה, משמשת כשהרכיב מוצג למשתמש כרכיב שיש לו את היכולת שמתוארת במסנן.
התווית מוגדרת כהפניה למשאב מחרוזת, כדי שאפשר יהיה לבצע לה לוקליזציה כמו למחרוזות אחרות בממשק המשתמש. עם זאת, כדי להקל על הפיתוח של האפליקציה, אפשר להגדיר אותו גם כמחרוזת גולמית.
ערך ברירת המחדל הוא התווית שהוגדרה על ידי רכיב ההורה. אם לא מציינים תווית ברמת ההורה, ברירת המחדל היא התווית שמוגדרת במאפיין
label
של הרכיב<application>
.מידע נוסף על תוויות של מסנני כוונות זמין בקטע סמלים ותוויות בסקירה הכללית של קובץ המניפסט של האפליקציה.
android:priority
- העדיפות שניתנת לרכיב ההורה בנוגע לטיפול בכוונות מהסוג שמתואר במסנן. למאפיין הזה יש משמעות גם לפעילויות וגם למקלטי שידור.
- המדד הזה מספק מידע על מידת היכולת של פעילות מסוימת להגיב לכוונה שתואמת למסנן, בהשוואה לפעילויות אחרות שיכולות גם הן להגיב לכוונה. כשמספר פעילויות עם רמות עדיפות שונות יכולות לטפל בכוונה, מערכת Android מתייחסת רק לפעילויות עם רמות עדיפות גבוהות יותר כיעדים פוטנציאליים לכוונה.
הוא קובע את הסדר שבו מתבצעת ההפעלה של מקבלי השידור כדי לקבל הודעות שידור, כאשר אלה עם ערכי העדיפות הגבוהים יותר נקראים לפני אלה עם ערכי העדיפות הנמוכים יותר. הסדר רלוונטי רק להודעות סינכרוניות. הוא מתעלם מהערך הזה בהודעות אסינכררוניות.
יש להשתמש במאפיין הזה רק אם אתם צריכים לקבוע סדר ספציפי שבו השידור יגיע, או אם אתם רוצים לאלץ את Android להעדיף פעילות אחת על פני אחרות.
הערך הוא מספר שלם, כמו
100
. מספרים גבוהים יותר מייצגים עדיפות גבוהה יותר. ערך ברירת המחדל הוא0
.בנסיבות מסוימות, המערכת מתעלמת מהעדיפות המבוקשת והערך מוגבל ל-
0
. המצב הזה מתרחש במקרים הבאים:- אפליקציה ללא הרשאות מבקשת כל עדיפות >0.
- אפליקציה בעלת הרשאות מבקשת עדיפות >0 עבור
ACTION_VIEW
,ACTION_SEND
,ACTION_SENDTO
אוACTION_SEND_MULTIPLE
.
מידע נוסף זמין במאמר
setPriority()
. android:order
הסדר שבו המסנן מעובד כשיש התאמה של כמה מסננים.
ההבדל בין
order
לביןpriority
הוא ש-priority
חלה על כמה אפליקציות, בעוד ש-order
מאפשרת להסיר מחלוקות לגבי מסננים מרובים שתואמים לאפליקציה אחת.כשיש כמה מסננים שיכולים להתאים, כדאי להשתמש בכוונה מכוונת במקום זאת.
הערך הוא מספר שלם, כמו
100
. מספרים גבוהים יותר מותאמים קודם. ערך ברירת המחדל הוא0
.המאפיין הזה הוצג ברמת API 28.
android:autoVerify
- אם מערכת Android צריכה לאמת שקובץ ה-JSON של Digital Asset Links מהמארח שצוין תואם לאפליקציה הזו.
מידע נוסף זמין במאמר אימות קישורים לאפליקציות ל-Android.
ערך ברירת המחדל הוא
false
.המאפיין הזה הוצג ברמת API 23.
- הופיע לראשונה:
- רמת API 1
- מידע נוסף:
<action>
<category>
<data>
<uri-relative-filter-group>
<intent-filter>
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-27 (שעון UTC).
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["חסרים לי מידע או פרטים","missingTheInformationINeed","thumb-down"],["התוכן מורכב מדי או עם יותר מדי שלבים","tooComplicatedTooManySteps","thumb-down"],["התוכן לא עדכני","outOfDate","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["בעיה בדוגמאות/בקוד","samplesCodeIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 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)"]]