Is There a Maximum Size to Android Internal Storage Allocated for an App

is there a maximum size to android internal storage allocated for an app?

If you use Environment.getExternalStorageDirectory() (or Context.getExternalFilesDir() for API level 8 and up) as the place for your json file, then I believe the size will be limited by the available space in the external storage (usually an SD card). For most devices, I believe there are no fixed limits built into Android for external file storage. (Internal storage is a different matter. Device manufacturers can impose quite restrictive limits, perhaps as low as 100MB shared among all applications.)

UPDATE: Note that according to the compatibility definition for Android 2.3 (Section 7.6.1), devices should have quite a bit of memory:

Device implementations MUST have at least 150MB of non-volatile storage available for user data. That is, the /data partition MUST be at least 150MB.

Beyond the requirements above, device implementations SHOULD have at least 1GB of non-volatile storage available for user data. Note that this
higher requirement is planned to become a hard minimum in a future version of Android. Device implementations are strongly encouraged to meet
these requirements now, or else they may not be eligible for compatibility for a future version of Android.

This space is shared by all applications, so it can fill up. There is no guaranteed minimum storage available for each app. (Such a guaranteed minimum would be worthless for apps that need to store more than the minimum and would be a waste for apps that store less.)

Edit: From the compatibility definition for Android 4.0

Device implementations MUST have at least 350MB of non-volatile storage available for user data. That is, the /data partition MUST be at least 350MB.

From the compatibility definition for Android 4.3

Device implementations MUST have at least 512MB of non-volatile storage available for user data. That is, the /data partition MUST be at least 512MB.

Interestingly, the recommendation that implementations SHOULD provide at least 1GB has stayed the same.

Android App MAX Data Storage(Internal Memory) Capacity Definition and file Visibility Gallery/3rd party apps

Adding on to Amit K. Saha answer..

1)Any Application can store upto available device internal memory, no restriction.

2)Whichever application first reserve gets the first prioprity.First-Come-First-Served.

3)Used file provider: Copied the files to app private memory(so that the file is protected) sub-folder and use file provider to give access to the files so that ,the external app can show content.

https://developer.android.com/training/secure-file-sharing/setup-sharing.html

What should be the max amount of data stored in an Android app's internal storage space?

I guess that the question is about where to install the application. It's a trade off between saving the user's internal storage and providing full time access.

From my point of view, as soon as you app weights more than 20 MB, you should make it install on the external storage. If the external storage becomes unavailable, I probably means that the user is not using any app...

On top of that, lots of heavy apps get bad ratings for not allowing installation on external storage (Chrome is an famous example weighing more than 60 MB).

Max app space (storage)

The APK limit has been increased from 50MB to 4GB (see http://androidcommunity.com/android-market-upgrading-app-size-limit-to-4gb-20110511/ ), so one would presume that an app could store up to 4GB.

That said, you should be storing any large files on SD card (or similar) instead of taking up the app space (some phones this is shared space, such as the Galaxy Nexus.) Doing it that way won't have any limits except the space available on the SD card from my understanding.

Should I use external storage for data exclusive to my app?

Use the path returned by 'getExternalFilesDir(String type)'

From the documentation:

"Returns the absolute path to the directory on the primary external filesystem (that is somewhere on Environment.getExternalStorageDirectory()) where the application can place persistent files it owns. These files are internal to the applications, and not typically visible to the user as media.

This is like getFilesDir() in that these files will be deleted when the application is uninstalled, however there are some important differences:

External files are not always available: they will disappear if the user mounts the external storage on a computer or removes it. See the APIs on Environment for information in the storage state.There is no security enforced with these files. For example, any application holding WRITE_EXTERNAL_STORAGE can write to these files."

For further details: http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir(java.lang.String)

So yes, you can use external storage and have the files deleted when the app is uninstalled (as long as you are happy with the lack of security).

Internal phone storage in Android

Use android.os.Environment to find the internal directory, then use android.os.StatFs to call the Unix statfs system call on it. Shamelessly stolen from the Android settings app:

File path = Environment.getDataDirectory();
StatFs stat = new StatFs(path.getPath());
long blockSize = stat.getBlockSize();
long availableBlocks = stat.getAvailableBlocks();
return Formatter.formatFileSize(this, availableBlocks * blockSize);


Related Topics



Leave a reply



Submit