简体   繁体   中英

Xamarin Android: Get installed app list with icons

I create Xamarin Android app in VS2017. How get installed app list with icons? and run program from this list.

Get installed apps list(in non activity class)

var apps = Android.App.Application.Context.PackageManager.GetInstalledApplications(PackageInfoFlags.MatchAll);

Get app name:

apps[0].LoadLabel(Android.App.Application.Context.PackageManager);

Get package name:

apps[0].PackageName;

Get app icon:

apps[0].LoadIcon(Android.App.Application.Context.PackageManager);

Run app from list:

Intent intent = PackageManager.GetLaunchIntentForPackage(apps[0].PackageName);
StartActivity(intent);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM