First, let's take a look. Packageiteminfo, It is a base class that contains some information. Its direct subclasses include: Applicationinfo , Componentinfo , Instrumentationinfo , Permissiongroupinfo , Permissioninfo . Its indirect subclasses include: Activityinfo ,Providerinfo , Serviceinfo . The information contained in this class is equal for all projects in the package. These Package items Yes Package Manager . This class provides basic settings for attributes: Label , Icon And Meta-daTa . This class is not intended to be called by itself. It is simply shared herePackage Manager All Items . For example, it is not implemented by itself Parcelable Interface, but it helps to implement Parcelable Subclass provides a convenient method.
ApplicationinfoIs the information obtained from a specific application. The information is relativeAndrodimanifest. xmlOf<Application>Tag.
ResolveinfoThis class resolvesIntentfilterCorrespondingIntentThe obtained information. It partially corresponds toAndroidmanifest. xmlOf<Intent>Tag Information.
PackagemanagerThis class is used to return information about various packages associated with the applications currently mounted to the device. You can useGetpacagemanagerTo obtain this class.
ApplicationinfoAndResolveinfoComparison: the former can obtainIcon,Label,Meta-daTa,Description. The latter can only getIcon,Label.
The following describes the specific applications that combine these categories:
By callingPackagemanagerYou can get two different types of information:
First, you must obtainManager:
1 Packagemanager Manager=Getpackagemanager ();
Method 1:
List <applicationinfo> applist = manager. getinstalledapplications (packagemanager. Get. uninstalled_pakages );
It is resolved throughAndroidmanifest. xmlOf<Application>Label, so it can get allApp.
Method 2:
1 Intent intent = New Intent (intent. A ction_main, Null );
2
3 Intent. addcategory (intent. category_launcher );
4
5 List < Resolveinfo > Applist = Manager. queryintentactivities (intent, 0 );
It is resolved through<Intent-filter>The tag is
1 <Action Android: Name="Android. Intent. Action. Main"/>
2
3 <Action Android: Name="Android. Intent. Category. launcher"/>
app, , so we get less than the first method (the former is more than the service , previder and other app ).