Closed DawnImpulse closed 5 years ago
That's not a good way of calculating size of cache dir.
[StorageStats#getCacheBytes()](https://developer.android.com/reference/android/app/usage/StorageStats.html#getCacheBytes()) is available from O.
For older versions hacky reflections available PackageStats#cacheSize
@mohammaduvez ohh thats a very easy solution. Thanks a lot :)
@mohammaduvez I completely agree on your solution and it is very good although not so easy to implement also after very careful analysis I found that to get just the app cache size, my approach is very efficient actually.
The crash mentioned above was only the single instance in the past 9 months & there are a lot of users on this application on all kinds of devices. So, for now, I am going to stick with my approach.
Although thanks a lot for giving such good advice and it is very helpful in many situations where my approach will simply fail. So again thanks for that
Issue
App crashes when checking for the total size of the cache directory.
Info
From Crashlytics
Possible Solution