更新时间:2021-09-10 06:47:46
您可以通过使用的 PacketManager 。
code从这里 :
You can get a list of installed applications by using the PacketManager. Code from here:
public class AppList extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PackageManager pm = this.getPackageManager();
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
List list = pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);
for (ResolveInfo rInfo : list) {
Log.w("Installed Applications", rInfo.activityInfo.applicationInfo
.loadLabel(pm).toString());
}
}
要看到当前运行的应用程序,你可以使用 ActivityManager
To see the currently running apps, you can use the ActivityManager.