- نحو:
<activity-alias android:enabled=["true" | "false"] android:exported=["true" | "false"] android:icon="drawable resource" android:label="string resource" android:name="string" android:permission="string" android:targetActivity="string" > ... </activity-alias>
- موجود در:
-
<application>
- می تواند شامل:
-
<intent-filter>
<meta-data>
- توضیحات:
- نام مستعار یک اکتیویتی که با ویژگی
targetActivity
نامگذاری شده است. هدف باید در همان برنامه مستعار باشد و قبل از نام مستعار در مانیفست اعلام شود.نام مستعار فعالیت هدف را به عنوان یک موجودیت مستقل نشان می دهد و می تواند مجموعه ای از فیلترهای هدف خود را داشته باشد. آنها، به جای فیلترهای intent روی فعالیت هدف، تعیین می کنند که کدام intent می تواند هدف را از طریق نام مستعار فعال کند و سیستم چگونه با نام مستعار رفتار می کند.
برای مثال، فیلترهای intent روی نام مستعار ممکن است پرچمهای
"android.intent.action.MAIN"
و"android.intent.category.LAUNCHER"
" را مشخص کنند و باعث شوند که در راهانداز برنامه نمایش داده شود، حتی اگر هیچ یک از فیلترها وجود نداشته باشد. روی فعالیت هدف خود این پرچم ها را تنظیم کنید.به استثنای
targetActivity
، ویژگیهای<activity-alias>
زیرمجموعهای از ویژگیهای<activity>
هستند. برای ویژگی های زیر مجموعه، هیچ یک از مقادیر تعیین شده برای هدف به نام مستعار منتقل نمی شود. با این حال، برای ویژگیهایی که در زیرمجموعه نیستند، مقادیر تعیینشده برای فعالیت هدف برای نام مستعار نیز اعمال میشود. - صفات:
-
android:enabled
- آیا فعالیت هدف می تواند توسط سیستم از طریق این نام مستعار نمونه سازی شود یا خیر.
"true"
اگر می تواند باشد و"false"
اگر نه. مقدار پیش فرض"true"
است.عنصر
<application>
ویژگیenabled
خود را دارد که برای همه اجزای برنامه از جمله نام مستعار فعالیت اعمال می شود. ویژگیهای<application>
و<activity-alias>
هر دو باید"true"
باشند تا سیستم بتواند فعالیت هدف را از طریق نام مستعار نمونهسازی کند. اگر هر کدام"false"
باشد، نام مستعار کار نمی کند. -
android:exported
- آیا اجزای برنامه های کاربردی دیگر می توانند فعالیت هدف را از طریق این نام مستعار راه اندازی کنند یا خیر. اگر بتوانند
"true"
و اگر نه"false"
. اگر"false"
باشد، فعالیت هدف را می توان از طریق نام مستعار تنها توسط مؤلفه های همان برنامه کاربردی با نام مستعار یا برنامه هایی با همان شناسه کاربری راه اندازی کرد.مقدار پیش فرض بستگی به این دارد که آیا نام مستعار حاوی فیلترهای intent باشد یا خیر. عدم وجود فیلتر به این معنی است که فعالیت را می توان از طریق نام مستعار تنها با تعیین نام دقیق نام مستعار فراخوانی کرد. این بدان معناست که نام مستعار فقط برای استفاده داخلی برنامه در نظر گرفته شده است، زیرا دیگران نام آن را نمی دانند. بنابراین، مقدار پیش فرض
"false"
است. از طرف دیگر، وجود حداقل یک فیلتر نشان می دهد که نام مستعار برای استفاده خارجی در نظر گرفته شده است، بنابراین مقدار پیش فرض"true"
است. -
android:icon
- نمادی برای فعالیت هدف زمانی که از طریق نام مستعار به کاربران ارائه می شود. برای اطلاعات بیشتر، ویژگی
icon
عنصر<activity>
را ببینید. -
android:label
- یک برچسب قابل خواندن توسط کاربر برای نام مستعار زمانی که از طریق نام مستعار به کاربران ارائه شود. برای اطلاعات بیشتر، ویژگی
label
عنصر<activity>
را ببینید. -
android:name
- یک نام منحصر به فرد برای نام مستعار. این نام شبیه یک نام کلاس کاملاً واجد شرایط است. اما برخلاف نام فعالیت هدف، نام مستعار دلخواه است. به یک کلاس واقعی اشاره نمی کند.
-
android:permission
- نام مجوزی که مشتریان باید برای راه اندازی فعالیت هدف یا دریافت آن برای انجام کاری با استفاده از نام مستعار داشته باشند. اگر به فراخواننده
startActivity()
یاstartActivityForResult()
مجوز مشخص شده داده نشود، فعالیت هدف فعال نمی شود.این ویژگی جایگزین هر گونه مجوز تنظیم شده برای خود فعالیت هدف می شود. اگر تنظیم نشده باشد، مجوزی برای فعال کردن هدف از طریق نام مستعار لازم نیست.
برای اطلاعات بیشتر در مورد مجوزها، به بخش مجوزها در نمای کلی مانیفست برنامه مراجعه کنید.
-
android:targetActivity
- نام فعالیتی که می توان از طریق نام مستعار فعال کرد. این نام باید با ویژگی
name
عنصر<activity>
که قبل از نام مستعار در مانیفست قرار دارد مطابقت داشته باشد.
-
- معرفی شده در:
- API سطح 1
- همچنین ببینید:
-
<activity>
<activity-alias>
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-07-29 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-29 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# <activity-alias\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cactivity-alias android:enabled=[\"true\" | \"false\"]\n android:exported=[\"true\" | \"false\"]\n android:icon=\"drawable resource\"\n android:label=\"string resource\"\n android:name=\"string\"\n android:permission=\"string\"\n android:targetActivity=\"string\" \u003e\n ...\n \u003c/activity-alias\u003e\n ```\n\ncontained in:\n: [\u003capplication\u003e](/guide/topics/manifest/application-element)\n\ncan contain:\n: [\u003cintent-filter\u003e](/guide/topics/manifest/intent-filter-element)\n\n [\u003cmeta-data\u003e](/guide/topics/manifest/meta-data-element)\n\ndescription:\n: An alias for an activity, named by the `targetActivity`\n attribute. The target must be in the same application as the\n alias and declared before the alias in the manifest.\n\n\n The alias presents the target activity as an independent entity, and can have its own set of intent\n filters. They, rather than the\n intent filters on the target activity itself, determine which intents\n can activate the target through the alias and how the system\n treats the alias.\n\n For example, the intent filters on the alias might\n specify the [\"android.intent.action.MAIN\"](/reference/android/content/Intent#ACTION_MAIN)\n and [\"android.intent.category.LAUNCHER\"](/reference/android/content/Intent#CATEGORY_LAUNCHER)\" flags, causing it to\n be represented in the application launcher, even though none of the\n filters on the target activity itself set these flags.\n\n\n With the exception of `targetActivity`, `\u003cactivity-alias\u003e`\n attributes are a subset of [\u003cactivity\u003e](/guide/topics/manifest/activity-element) attributes.\n For attributes in the subset, none of the values set for the target carry over\n to the alias. However, for attributes not in the subset, the values set for\n the target activity also apply to the alias.\n\nattributes:\n:\n\n `android:enabled`\n : Whether the target activity can be instantiated by the system through\n this alias. `\"true\"` if it can be, and `\"false\"` if not.\n The default value is `\"true\"`.\n\n\n The [\u003capplication\u003e](/guide/topics/manifest/application-element) element has its own\n [enabled](/guide/topics/manifest/application-element#enabled) attribute that applies to all\n application components, including activity aliases. The\n `\u003capplication\u003e` and `\u003cactivity-alias\u003e`\n attributes must both be `\"true\"` for the system to be able to instantiate\n the target activity through the alias. If either is `\"false\"`, the alias\n doesn't work.\n\n `android:exported`\n : Whether the components of other applications can launch the target activity\n through this alias. `\"true\"` if they can, and `\"false\"` if not.\n If `\"false\"`, the target activity can be launched through the alias only by\n components of the same application as the alias or applications with the same user ID.\n\n\n The default value depends on whether the alias contains intent filters. The\n absence of any filters means that the activity can be invoked through the alias\n only by specifying the exact name of the alias. This implies that the alias\n is intended only for application-internal use, since others don't know its name.\n So, the default value is `\"false\"`.\n On the other hand, the presence of at least one filter implies that the alias\n is intended for external use, so the default value is `\"true\"`.\n\n `android:icon`\n : An icon for the target activity when presented to users through the alias.\n For more information, see the [\u003cactivity\u003e](/guide/topics/manifest/activity-element) element's\n [icon](/guide/topics/manifest/activity-element#icon) attribute.\n\n `android:label`\n : A user-readable label for the alias when presented to users through the alias.\n For more information, see the [\u003cactivity\u003e](/guide/topics/manifest/activity-element) element's\n [label](/guide/topics/manifest/activity-element#label) attribute.\n\n \u003cbr /\u003e\n\n `android:name`\n\n : A unique name for the alias. The name resembles a fully qualified class name. But, unlike the name of the target activity, the alias name is arbitrary. It doesn't refer to an actual class. \u003cbr /\u003e\n\n `android:permission`\n : The name of a permission that clients must have to launch the target activity\n or get it to do something using the alias. If a caller of\n [startActivity()](/reference/android/content/Context#startActivity(android.content.Intent)) or\n [startActivityForResult()](/reference/android/app/Activity#startActivityForResult(android.content.Intent, int))\n isn't granted the specified permission, the target activity isn't activated.\n\n This attribute supplants any permission set for the target activity itself. If\n it isn't set, a permission isn't needed to activate the target through the alias.\n\n\n For more information about permissions, see the\n [Permissions](/guide/topics/manifest/manifest-intro#perms)\n section in the app manifest overview.\n\n `android:targetActivity`\n : The name of the activity that can be activated through the alias.\n This name must match the `name` attribute of an\n [\u003cactivity\u003e](/guide/topics/manifest/activity-element) element that precedes\n the alias in the manifest.\n\n \u003cbr /\u003e\n\nintroduced in:\n: API level 1\n\nsee also:\n: [\u003cactivity\u003e](/guide/topics/manifest/activity-element)"]]