Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I want to save a json file with all the application data (something similar to preference) but im not sure what is the limit size, because if the app cant use this file it will not function probably. is this information known beforehand and the OS reserve some space for your app or its based on the size available.

Update: I dont really care about External storage since is not always available in the device and could be changed (SD card) and i could check for internal storage using this but this is not what i want to know, What i want to know if there's a memory size allocated for internal storage for the device ?

like image 692
Jimmy Avatar asked Feb 08 '12 17:02

Jimmy


People also ask

What takes up most of internal storage on Android?

Photos and videos can be some of the most space-hogging items on your phone.

Do apps take up internal storage?

Android phones and tablets can fill up quickly as you download apps, add media files like music and movies, and cache data for use offline. Many lower-end devices may only include a few gigabytes of storage, making this even more of a problem.


2 Answers

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.

like image 152
Ted Hopp Avatar answered Sep 28 '22 18:09

Ted Hopp


I've never witnessed it limit a single application, and I have tested it with saving some rather large (200 mb) video files in the app Files dir before.

For internal storage I think your only limited by the amount of internal storage made available for all applications to share. Which as @Ted Hopp mentioned is rather small on some of the older and lower end devices. But on the newer and higher end devices they've started bumping it up to a reasonable amount, though even if the device has a lot of space, it could still be taken up by other applications(so you need to test what will happen in this scenario).

It is also worth pointing out that if you use external storage such as the SD card then your json file would technically editable by the user. They could open it up in a text editor and start changing the raw values if they had any desire to. (This is also possible if you choose to use internal storage, but it would require a rooted device, whereas if it is stored on the SD card would not require root)

So if you are storing info that you'd rather the user not have the option to manually edit, you may want to take that into consideration.

like image 32
FoamyGuy Avatar answered Sep 28 '22 16:09

FoamyGuy