LauncherApps.GetActivityList(String, UserHandle) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Retrieves a list of activities that specify Intent#ACTION_MAIN
and
Intent#CATEGORY_LAUNCHER
, across all apps, for a specified user.
[Android.Runtime.Register("getActivityList", "(Ljava/lang/String;Landroid/os/UserHandle;)Ljava/util/List;", "GetGetActivityList_Ljava_lang_String_Landroid_os_UserHandle_Handler")]
public virtual System.Collections.Generic.IList<Android.Content.PM.LauncherActivityInfo>? GetActivityList (string? packageName, Android.OS.UserHandle? user);
[<Android.Runtime.Register("getActivityList", "(Ljava/lang/String;Landroid/os/UserHandle;)Ljava/util/List;", "GetGetActivityList_Ljava_lang_String_Landroid_os_UserHandle_Handler")>]
abstract member GetActivityList : string * Android.OS.UserHandle -> System.Collections.Generic.IList<Android.Content.PM.LauncherActivityInfo>
override this.GetActivityList : string * Android.OS.UserHandle -> System.Collections.Generic.IList<Android.Content.PM.LauncherActivityInfo>
Parameters
- packageName
- String
The specific package to query. If null, it checks all installed packages in the profile.
- user
- UserHandle
The UserHandle of the profile.
Returns
List of launchable activities. Can be an empty list but will not be null.
- Attributes
Remarks
Retrieves a list of activities that specify Intent#ACTION_MAIN
and Intent#CATEGORY_LAUNCHER
, across all apps, for a specified user. If an app doesn't have any activities that specify ACTION_MAIN
or CATEGORY_LAUNCHER
, the system adds a synthesized activity to the list. This synthesized activity represents the app's details page within system settings.
<p class="note"><b>Note: </b>It's possible for system apps, such as app stores, to prevent the system from adding synthesized activities to the returned list.</p>
As of Android Q, at least one of the app's activities or synthesized activities appears in the returned list unless the app satisfies at least one of the following conditions:
<ul> <li>The app is a system app.</li> <li>The app doesn't request any permissions. </li> <li>The app doesn't have a <em>launcher activity</em> that is enabled by default. A launcher activity has an intent containing the ACTION_MAIN
action and the CATEGORY_LAUNCHER
category.</li> </ul>
Additionally, the system hides synthesized activities for some or all apps in the following enterprise-related cases:
<ul> <li>If the device is a fully managed device, no synthesized activities for any app appear in the returned list.</li> <li>If the current user has a work profile, no synthesized activities for the user's work apps appear in the returned list.</li> </ul>
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.