开发者

get information of app in android

开发者 https://www.devze.com 2023-03-11 03:57 出处:网络
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?

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号