android - Getting installed app size -
I would like to achieve an installed app size, I am trying to learn it. Unfortunately, the current official to do so. However, if you import AIDL and generate stubs in our project, then you can call the hidden method. You can use the reflection to reapply: This is the reason that for obviously a big hack and for public applications.
what has already failed:
- new file ( "/ data / app / some.apk ') - Report incorrect size
- PackageManager.getPackageSizeInfo (string PackageName, IPackageStatsObserver Observer) - the
@hide and depends on some obscure
IPackageStatsObserver results so I can not call it through reflection .
PackageManager pm = getPackageManager (); . Method getPackageSizeInfo = pm.getClass () getMethod ( "getPackageSizeInfo", String.class, IPackageStatsObserver.class); getPackageSizeInfo.invoke (pm, "com.android.mms", New IPackageStatsObserver.Stub () {@Override public void onGetStatsCompleted (PackageStats pStats, Boolean successful) throws RemoteException {Log.i (TAG, "codeSize:" + pStats.codeSize );}});
Comments
Post a Comment