Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android, get app size

Tags:

android

I'm looking for a way to calculate the size of an installed Android application/package. I can't find this information in neither ApplicationInfo nor PackageInfo objects. From the ApplicationInfo I can get the path for the data and the app itself. Data is a directory structure, but when attempting to read it recursivly I get a nullpointer. Is there any better way of doing it? Any sample code?

like image 498
MrMozart Avatar asked Sep 13 '25 11:09

MrMozart


1 Answers

If you look at ManageApplications.java, you'll see that they use the hidden getPackageSizeInfo method of the PackageManager. This isn't part of the public API, so you shouldn't really use it.

Here's an example of how you shouldn't use it!

like image 60
Gareth Davidson Avatar answered Sep 14 '25 23:09

Gareth Davidson