2

I am having an Android Gallery app. But in the App settings, the storage space occupied by the app is shown as 724 MB.

The breakdown of space being occupied is as below

1) App - 75.63 MB

2) Data - 724 MB

3) Total - 800 MB

4) Cache - 2.01 MB

I am attaching a screenshot of the setting screen.

Can anyone please help to know what data is actually generated in the app which amounts to 724 MB and also what kind of files are counted as Data in the setting section. Also is it possible to clear this periodically?

Rahulrr2602
  • 701
  • 1
  • 13
  • 34
  • 1
    That will be `getFilesDir()`, `SharedPreferences`, and SQLite databases, mostly. – CommonsWare Mar 20 '18 at 11:46
  • 1
    What kind of data do you store? – Eselfar Mar 20 '18 at 11:47
  • @Eselfar I only have about 15 Shared preference. And I only cache the image, and video thumbnails and also the ads might be cached. – Rahulrr2602 Mar 20 '18 at 12:01
  • @CommonsWare Thanks. But can you please tell what is stored in the `getFilesDir()` is it the `/data/data/` directory as stated by @mesutpiskin – Rahulrr2602 Mar 20 '18 at 12:03
  • 2
    `/data/data//` isn't really correct -- the exact path varies by device and user. However, if we pretend that it is correct, then `getFilesDir()` is `/data/data//files`. What goes there is whatever you put there, either via your code or via third-party libraries. In a debug build, use Device File Explorer in Android Studio to examine what is in there. – CommonsWare Mar 20 '18 at 12:12
  • @CommonsWare Thank You very much for the help. – Rahulrr2602 Mar 20 '18 at 12:21
  • @CommonsWare Can you help me with a similar question https://stackoverflow.com/questions/49773996/app-data-contains-large-files – Rajesh K Apr 11 '18 at 12:11

1 Answers1

2

You can find a general explanation of the Android directory hierarchy in my answer here. For your specific question I might add some more details on the /data/data/<package_name> (and corresponding SD-part):

databases/: here go the app's databases

lib/: libraries and helpers for the app

files/: other related files

shared_prefs/: preferences and settings

cache/: well, caches

How to delete

shared preferences: Delete all sharedPreferences in Android

cache: Clear Cache in Android Application programmatically

app data : Clear Application's Data Programmatically and https://tips.seebrock3r.me/clear-the-app-data-quickly-android-studio-protips-1-ebc47ea06286

mesutpiskin
  • 1,771
  • 2
  • 26
  • 30
  • Thank you very much for the excellent and helpful explanation. Can you please tell whether it is possible to view the `/data/data/` directory using a File explorer without rooting the device? – Rahulrr2602 Mar 20 '18 at 12:04
  • Yes you can see some files with file manager. example for my device Android/data/com.android.camera2/ is have files cache and files directory. Cleaner applications work this way. – mesutpiskin Mar 20 '18 at 13:17
  • OK. Once again Thank You. – Rahulrr2602 Mar 20 '18 at 14:16
  • @mesutpiskin Can you help me with a similar question https://stackoverflow.com/questions/49773996/app-data-contains-large-files – Rajesh K Apr 11 '18 at 12:10