אינטראקציה עם אפליקציות אחרות
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
אפליקציה ל-Android בדרך כלל כוללת כמה פעילויות. בכל פעילות מוצג ממשק משתמש שמאפשר למשתמש לבצע משימה ספציפית, כמו הצגת מפה או צילום תמונה.
כדי להעביר את המשתמש מפעילות אחת לפעילות אחרת, האפליקציה צריכה להשתמש ב-Intent
כדי להגדיר את 'כוונת' האפליקציה לבצע משהו. כשמעבירים למערכת את הערך Intent
באמצעות שיטה כמו startActivity()
, המערכת משתמשת ב-Intent
כדי לזהות את רכיב האפליקציה המתאים ולהפעיל אותו. שימוש בכוונות מאפשר לאפליקציה להתחיל פעילות שנמצאת באפליקציה נפרדת.
ה-Intent
יכול להיות מפורש, כדי להפעיל מופע Activity
ספציפי, או מרומז, כדי להפעיל כל רכיב שיכול לטפל בפעולה המיועדת, למשל 'צילום תמונה'.
בנושאים במדריך הזה מוסבר איך להשתמש ב-Intent
כדי לבצע אינטראקציות בסיסיות עם אפליקציות אחרות, כמו הפעלת אפליקציה אחרת, קבלת תוצאה מהאפליקציה הזו והפעלת תגובה של האפליקציה שלכם לכוונות (intents) מאפליקציות אחרות.
נושאים
- שליחת המשתמש לאפליקציה אחרת
- איך יוצרים כוונות משתמשים מרומזות כדי להפעיל אפליקציות אחרות שיכולות לבצע פעולה.
- קבלת תוצאה מפעילות
- איך מתחילים פעילות אחרת ומקבלים תוצאה מהפעילות.
- איך מאפשרים לאפליקציות אחרות להתחיל את הפעילות
- איך מגדירים מסנני כוונות שמצהירים על הכוונות המשתמעות שהאפליקציה מקבלת, כדי לאפשר לפעילויות באפליקציה להיות פתוחות לשימוש באפליקציות אחרות.
- סינון של חשיפת חבילות ב-Android
- איך להפוך אפליקציות אחרות לגלויה לאפליקציה שלכם, אם הן לא גלויות כברירת מחדל. הדרישה הזו רלוונטית רק לאפליקציות שמטרגטות ל-Android 11 (רמת API 30) ואילך.
- התאמה לתרחישים נפוצים לדוגמה עם חשיפה מוגבלת של החבילה
- ההודעה הזו מופיעה אם יש כמה סוגים של אינטראקציות בין האפליקציות, וייתכן שתצטרכו לעדכן את קובץ המניפסט של האפליקציה כדי שאפליקציות אחרות יהיו גלויות לאפליקציה שלכם. ההודעה הזו רלוונטית רק לאפליקציות שמטרגטות ל-Android 11 (רמת API 30) ואילך.
- הגבלת הטעינה בקונטיינרים מקומיים של Android
- איך להגביל את הטעינה של אפליקציית Play Store באפליקציה של סביבה מדומה של Android, שנקראת גם מאגר Android במכשיר.
מידע נוסף על הנושאים בדף הזה זמין במאמרים הבאים:
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-02-10 (שעון UTC).
[null,null,["עדכון אחרון: 2025-02-10 (שעון UTC)."],[],[],null,["# Interact with other apps\n\nAn Android app typically has several [activities](/guide/components/activities). Each activity displays a\nuser interface that lets the user perform a specific task, such as viewing a map or taking a photo.\nTo take the user from one activity to another, your app must use an [Intent](/reference/android/content/Intent) to define your app's \"intent\" to do something. When you pass an\n`Intent` to the system with a method\nsuch as [startActivity()](/reference/android/app/Activity#startActivity(android.content.Intent)),\nthe system uses the `Intent` to identify and start the appropriate app component. Using intents\neven lets your app start an activity that is contained in a separate app.\n\nAn `Intent` can be *explicit* , to start\na specific [Activity](/reference/android/app/Activity) instance,\nor *implicit*, to start any\ncomponent that can handle the intended action, such as \"capture a photo.\"\n\nThe topics in this guide show you how to use an `Intent` to perform some basic\ninteractions with other apps, such as starting another app, receiving a result from that app, and\nmaking your app able to respond to intents from other apps.\n\nTopics\n------\n\n**[Sending the user to another app](/training/basics/intents/sending)**\n: Shows you how to create implicit intents to launch other apps that can perform an\n action.\n\n**[Get a result from an activity](/training/basics/intents/result)**\n: Shows you how to start another activity and receive a result from the activity.\n\n**[Allow other apps to start your activity](/training/basics/intents/filters)**\n: Shows you how to make activities in your app open for use by other apps by defining\n intent filters that declare the implicit intents your app accepts.\n\n**[Package visibility filtering on Android](/training/basics/intents/package-visibility)**\n: Shows you how to make other apps visible to your app if they\n aren't visible by default. Applies only to apps that target Android 11\n (API level 30) or higher.\n\n**[Fulfill common use cases while\nhaving limited package visibility](/training/basics/intents/package-visibility-use-cases)**\n: Shows several types of app interactions that might require you to update\n your app's manifest file so that other apps are visible to your app.\n Applies only to apps that target Android 11 (API level 30) or higher.\n\n**[Limit loading in on-device Android containers](/training/basics/intents/limit-play-loading)**\n: Shows you how to limit your Play Store app from loading in a simulated\n Android environment app, also known as an on-device Android container.\n\nFor additional information about the topics on this page, see the following:\n\n- [Sharing simple data](/training/sharing)\n- [Sharing files](/training/secure-file-sharing)\n- [Integrating Application with Intents](http://android-developers.blogspot.com/2009/11/integrating-application-with-intents.html) blog post\n- [Intents and Intent\n Filters](/guide/components/intents-filters)"]]