📌  相关文章
📜  如何使用 java 代码示例在 android 设备上查找所有应用程序

📅  最后修改于: 2022-03-11 14:52:07.483000             🧑  作者: Mango

代码示例1
final PackageManager pm = getPackageManager();
//get a list of installed apps.
List packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);

for (ApplicationInfo packageInfo : packages) {
    Log.d(TAG, "Installed package :" + packageInfo.packageName);
    Log.d(TAG, "Source dir : " + packageInfo.sourceDir);
    Log.d(TAG, "Launch Activity :" + pm.getLaunchIntentForPackage(packageInfo.packageName)); 
}
// the getLaunchIntentForPackage returns an intent that you can use with startActivity()