언어/Android
[Android] android.content.pm.PackageManager.getInstalledApplications
정현석
2010. 2. 18. 20:36
public abstract List<ApplicationInfo> getInstalledApplications (int flags)
디바이스에 설치된 모든 패키지 응용프로그램들의 리스트를 돌려준다. 만약 플래그를GET_UNINSTALLED_PACKAGES으로 셋팅하면 DONT_DELETE_DATA와 함께 삭제된 어플리케이션들의 리스트를 불러들여 돌려줄 것 이다.
파라메터들
flags : 옵션 플래그,, GET_META_DATA, GET_SHARED_LIBRARY_FILES, {link #GET_UNINSTALLED_PACKAGES}
리턴값
ApplicationInfo 객체의 리스트이며 아래와 같이 사용할 수 있다.
URL: http://androidside.com/docs/docs1.1/reference/android/content/pm/ApplicationInfo.html
List<ApplicationInfo> appList = manager.getInstalledApplications(0);
appList에는 설치된 Application의 정보들을 가지고 있게 되는데 아래와 같이 구성되어 있다.
Fields
public String className
Java class implementing the Application object. From the "class" attribute.
public String dataDir
Full path to a directory assigned to the package for its persistent data.
(설치된 Package의 FullPath가 담겨있다.)
public int descriptionRes
A style resource identifier (in the package's resources) of the description of an application. From the "description" attribute or, if not set, 0.
public boolean enabled
When false, indicates that all components within this application are considered disabled, regardless of their individually set enabled status.
public int flags
Flags associated with the application. Any combination of FLAG_SYSTEM, FLAG_DEBUGGABLE, FLAG_HAS_CODE, FLAG_PERSISTENT, FLAG_FACTORY_TEST, and FLAG_ALLOW_TASK_REPARENTING FLAG_ALLOW_CLEAR_USER_DATA.
public String manageSpaceActivityName
Java class implementing the Application's manage space functionality. From the "manageSpaceActivity" attribute. This is an optional attribute and will be null if application's dont specify it in their manifest
public String permission
Optional name of a permission required to be able to access this application's components. From the "permission" attribute.
public String processName
The name of the process this application should run in. From the "process" attribute or, if not set, the same as packageName.
예) com.android.fallback
public String publicSourceDir
Full path to the location of the publicly available parts of this package (i.e. the resources and manifest). For non-forward-locked apps this will be the same as {@link #sourceDir).
예) /system/app/Fallback.apk
public String[] sharedLibraryFiles
Paths to all shared libraries this application is linked against. This field is only set if the PackageManager.GET_SHARED_LIBRARY_FILES flag was used when retrieving the structure.
public String sourceDir
Full path to the location of this package.
예) /system/app/Fallback.apk
public String taskAffinity
Default task affinity of all activities in this application. See taskAffinity for more information. This comes from the "taskAffinity" attribute.
예) com.android.fallback
public int theme
A style resource identifier (in the package's resources) of the default visual theme of the application. From the "theme" attribute or, if not set, 0.
public int uid
The kernel user-ID that has been assigned to this application; currently this is not a unique ID (multiple applications can have the same uid).