get information of app in android
hello expert,
i want to get information of all apk in mobile, like name,icon,date etc.... i refer check it but there are not sa开发者_如何转开发tisfied solution. so can you help me?
From your activity you should call
List<ApplicationInfo> applications = getPackageManager().getInstalledPackages(0);
Then you can get the information by running though the applications list.
You can check http://developer.android.com/reference/android/content/pm/PackageManager.html#getInstalledApplications(int) for more info on the falgs you can use.
If you want the icon and install/update of an application you should instead use
List<PackageInfo> applications = getPackagerManager().getInstalledPackages(0);
This will give you a list of PackageInfos. Then you can acces the information you seek:
for(PackageInfo info : applications){
Drawable icon = info.applicationInfo.loadIcon(getContext());
long firstInstalled = info.firstInstallTime;
long lastUpdate = info.lastUpdateTime;
}
Checkout http://developer.android.com/reference/android/content/pm/PackageInfo.html to see what else you can get from the packageinfo.
In addition to the above answer, You should also have a look at http://developer.android.com/reference/android/os/Build.html.
It holds various informations regarding the cellphone (or tablet)
精彩评论