멋진 소스 발견.
PackageManager manager = getPackageManager();
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List<ResolveInfo> resolveInfos = manag.queryIntentActivities(mainIntent, 0);
for (int i = 0, iend = resolveInfos.size(); i < iend; i++) {
ResolveInfo ri = resolveInfos.get(i);
String pkgName = ri.activityInfo.applicationInfo.packageName; //패키지 이름
String className = ri.activityInfo.name; //클래스 이름(실행되는 액티비티 이름)
ComponentName componentName = new ComponentName(pkgName, className); //컴포넌트 생성 코드
CharSequence title = ri.loadLabel(manager); //어플리케이션 이름
Drawable icon = ri.activityInfo.loadIcon(manager); //어플리케이션 아이콘 Drawable
boolean thirdPartyFlag = false;
if ((ri.activityInfo.applicationInfo.flags
& android.content.pm.ApplicationInfo.FLAG_SYSTEM) == 0 ) {
// 다운로드 받은 어플리케이션
thirdPartyFlag = true;
} else {
// 프리로드된 어플리케이션
}
boolean isExternalApp = false;
if ((info.activityInfo.applicationInfo.flags & android.content.pm.ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0) {
// 외장메모리에 설치되는 어플리케이션
isExternalApp = true;
} else {
// 내장메모리에 설치되는 어플리케이션
isExternalApp = false;
}
}
출처 : http://blog.naver.com/PostView.nhn?blogId=dong277&logNo=130104023606&beginTime=0&jumpingVid=&from=search&redirect=Log&widgetTypeCall=true&topReferer=http%3A%2F%2Fsearch.naver.com%2Fsearch.naver%3Fwhere%3Dnexearch%26sm%3Dies_hty%26ie%3Dutf8%26query%3DgetPackageManager%28%29
댓글 없음:
댓글 쓰기