开发者

How to get Storage size of the Application

How do I get the storage size of all installed applications, programmatically, which are also disp开发者_C百科layed over application's ApplicationInfo page?


You could call

Process process = Runtime.getRuntime().exec(commandLine);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));

with commandLine something like ls -l /data/app/*.apk or ls -l /data/app-private

and parse the resulting data to get the information you need.


There is no public API to get this information. But there is a workaround using reflection and IPackageStatsObserver. Here is a description of how to get code size. You can get cache size and data size in the same way.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜