简体   繁体   English

如何在 Android 中获取并列出所有已安装/可用的导航应用程序及其图标?

[英]How to get and list all the installed/available navigations apps along with their icons in Android?

As the subject states, I'm looking for a way to get and list all the available navigations apps installed in the Android device along with their respective icons.正如主题所述,我正在寻找一种方法来获取并列出 Android 设备中安装的所有可用导航应用程序及其各自的图标。 Let's say the devices has Google Maps and Waze, I want to get all the info of these apps like their name, icon and package in order to open them from code.假设这些设备有 Google Maps 和 Waze,我想获取这些应用程序的所有信息,例如它们的名称、图标和 package,以便从代码中打开它们。

You can try this:你可以试试这个:

val packageManager: PackageManager = viewLayer.activity.packageManager
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0"))
val resolvedInfoList: List<ResolveInfo> = packageManager.queryIntentActivities(
    intent,
    PackageManager.MATCH_DEFAULT_ONLY
)
for (resolvedInfo in resolvedInfoList) {
    val packageName: String = resolvedInfo.activityInfo.applicationInfo.packageName
    val appName: String = resolvedInfo.activityInfo.applicationInfo.loadLabel(packageManager).toString()
    val launcherIcon: Drawable = resolvedInfo.activityInfo.applicationInfo.loadIcon(packageManager)
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取android中所有已安装应用的图标 - Get icons of all installed apps in android Android获取所有已安装应用的列表 - Android get a list of all installed apps 如何在Android手机上安装所有应用程序 - How to get all apps installed on android phone 如何获取 Android 11 中已安装应用程序的列表 - How to get a list of installed apps in Android 11 如何获取 Android 设备上已安装应用程序的列表 - How to get a list of installed apps on Android device 获取android 11(API 30)中所有已安装的应用程序,如何获取android 11中安装的所有其他应用程序? - Get all installed apps in android 11 (API 30) , how to get all other apps installed in android 11? 如何在Android的字符串数组列表中获取所有已安装的应用程序名称,包括系统应用程序 - How to get all the installed application's name including system apps in a string array list in android Xamarin Android:使用图标获取已安装的应用列表 - Xamarin Android: Get installed app list with icons 如何创建一个包含两列的列表视图,显示所有已安装的android应用及其权限? - How to create a listview with 2 columns showing all installed android apps and the permissions along with it? 如何在列表中获取所有共享应用程序(安装在设备上)? - How to get all share apps (installed on the device) in a list?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM