Usage of Application Info , Package Info and Resolve Info

删除回忆录丶 提交于 2019-12-13 04:38:19

问题


What is the use of Application info and how to use it. I'm confused how to retrieve the installed apps from the device and to display it with logo Can anyone please help me to sort it out. Differentiate the terms applicaiton info, package info and resolve info.


回答1:


to display a list of installed apps, you can try this

final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);

You will get all the necessary data in the ResolveInfo to start a application. You can check ResolveInfo

or try this code

PackageManager pm = this.getPackageManager();

    Intent intent = new Intent(Intent.ACTION_MAIN, null);
    intent.addCategory(Intent.CATEGORY_LAUNCHER);

    ArrayList<ResolveInfo> list = (ArrayList<ResolveInfo>) 
        pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);
        for (ResolveInfo rInfo : list) {
        System.out.println("Installed Applications " + rInfo.activityInfo.applicationInfo.loadLabel(pm).toString());
        }


来源:https://stackoverflow.com/questions/20747633/usage-of-application-info-package-info-and-resolve-info

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!