File size limit for internal vs. external storage? - android

I am looking for a best practice for considering internal vs. external storage depending on file size.
The docs give no size reference for internal storage getFilesDir(), but 1MB for getCacheDir():
You should always maintain
the cache files yourself and stay within a reasonable limit of space
consumed, such as 1MB.
Let's say an app needs to temporarily store video files, that are internal to the application. Assume 20 video files with 5MB each means 100MB total.
Is it reliable that the app can store 100MB in internal storage with getFilesDir()?

The Android 9 Compatibility Definition says:
Handheld device implementations:
[7.6.1/H-0-1] MUST have at least 4 GB of non-volatile storage
available for application private data (a.k.a. "/data" partition).
I believe this means that getFilesDir() is required to be at least 4 GB.
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.
Each Android version has a different amount of required storage space per app. If you are interested in the details, check out the other ACDs.

Related

Indexeddb storage limit on Phonegap/Cordova Android and how to increase it?

Are there any storage limits imposed on indexeddb for Android Cordova/Phonegap app, like localStorage does (5MB). If yes, then how can i explicitly ask the user to grant more disk space for the db? I tried finding some plugins but failed. I want to store JSON objects and file blobs.
Here I read, that 300MB has been tested safely:
https://stackoverflow.com/a/20675480/3134961
Raymond CAMDEN has written a very interesting article that will guide you : https://www.raymondcamden.com/2015/04/17/indexeddb-and-limits
You can also read this :
The shared pool can be up to 1/3 of the of available disk space.
Storage already used by apps is included in the calculation of the
shared pool; that is to say, the calculation is based on (available
storage space + storage being used by apps) * .333 .
Each app can have up to 20% of the shared pool.
As an example, if the total available disk space is 60 GB, the shared
pool is 20 GB, and the app can have up to 4 GB. This is calculated
from 20% (up to 4 GB) of 1/3 (up to 20 GB) of the available disk space
(60 GB).
(https://developer.chrome.com/apps/offline_storage#temporary)
It may be best to store your data in a native SQLite DB via a plugin such as cordova-sqlite-storage, since there is no storage limit.
Also note that on iOS all Webview data (including IndexedDB) is considered cache data which means the OS can wipe it if storage space becomes low on the device.

What is the expected behaviour of Adoptable Storage on Android M and how it should be handled by apps?

I am experimenting with the “Adoptable storage” introduced in Android Marshmallow and I need some guidance on the expected behaviour and how the apps should handle the “Adoptable storage”.
Format “micro SD” card as Adoptable storage by using “Format as Internal”
Once Format is done, there are 2 options given to the user as follows:
Move Now
Move Later
a. Move Now:
When this option is chosen by the user, the path returned by the getExternalFilesDirs
is “/storage/emulated/0/Android/data/PACKAGE_NAME/files” and it actually points to the file system of micro SD card.
b. Move Later:
When this option is chosen by the user, the path returned by the getExternalFilesDirs
is “/storage/emulated/0/Android/data/PACKAGE_NAME/files” and it actually points to the file system of Internal embedded memory.
In both the cases, the apps can see only one storage and the other storage is completely not accessible by the Apps to store data such as Photos, Videos, etc. Is there any way to access the storage paths of both the Internal and micro SD card when the micro SD card is formatted as “Adoptable storage” ?
Apart from this documentation ,I could not find a detailed documentation on how the apps should handle this adopted storage. Is there any API that app needs to use?
Example:
Let say, if the user phone has Internal memory of 32 GB and micro SD card of 32 GB.
If the card is formatted as “Portable storage”, both 32GB(Internal) and 32GB(micro SD card) are available to user to store data.
But If the user format the card as “Internal Memory”, the user can save data(photos/video/music,etc) only to any of this 32 GB storage location, but not to the both location. The system is providing an option of “Migrating data” between the storage locations(Internal to micro SD card and viceversa), but the apps can use only 32 GB of storage(The user effectively loses his 32 GB of storage to store Media files and can be only used to install the apps ?).
Is this the expected behaviour ?
Note: Test devices used - Moto X Play & HTC 10 - Both running Android 6.0.1
getExternalFilesDir() always points to the external storage, which may or may not be available. Use getFilesDir() to dynamically get the path to wherever the App is currently stored.
Don't store the result of this since Adoptable Storage may move your app around at any time. From the docs:
The returned path may change over time if the calling app is moved to an adopted storage device, so only relative paths should be persisted.

Which is faster to access a file in android, sdcard or system partition?

I have one simple question. If i have one file in system partition of android and if i copy the same file on sdcard, which will be faster to access?
Please answer this question.
Thanks in advance
The difference will be negligible. In any case, most newer devices have just one storage onboard the device, which is partitioned. In such devices, the need to access a separate SD Card goes away, as the memory is the same as the system storage.
On devices with an SD Card, there may be a very minute delay in accessing the file, but it will be negligible in pretty much any scenario.
You will not be able to really notice the access speed difference between accessing file from internal memory and SD Card.
With internal memory you will get added advantage of a security as it won't be accessible for other applications or you cannot access it by mounting.
The answer is Internal phone memory
because disk management(for phone ) is always better for internal memory as compared to SD card, So it is faster to access internal memory but you will not be able to notice the because difference is in mili seconds
With internal memory you will get advantage like user can't see your file until unless device is not rooted.
As stated, the time difference is not noticeable. However, a simple law of physics (and EE) will tell you that the longer the distance is (in this case the I/O bus), the longer it will take in time. Thus, the SDCard is slower than anything on the motherboard, even though it is measured in miliseconds.
I have found the SDCard is best used for static storage of your media files, and apps should be installed on the phone making them run as fast as possible, even though you can move some apps to the SDCard.
The speed is not noticeable unless you are coping the very large video files. The SD card speed is measured by class like:(Class 4, 6 or 10), the class 10 have higher speed as 10MB/S and class 2 have speed around 2MB/S. So, for good class of SD card, the speed gap is less. However, normally phone memory is faster than the SD card.

Max app space (storage)

I've looked around and have noticed that the max size for an apk is 50MB, but I am curious as to how much application space an app can download. Can one app take up all of the application storage or does it need to download additional content into the internal storage and/or sd card?
Thanks
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.

Is there a file size limit on Android Honeycomb?

I wanted to know if there was a size limit to the data files an android app can use or a size limit depending on the SD card (or internal memory) filesystem ?
Cheers
Olivier
The file size limit is determined by the filesystem. FAT32, for instance, cannot handle files larger than 4GB. Unfortunately, it is fairly likely that your microSD card is formatted in FAT32.
For Android 2.2 and older, the internal file system is YAFFS. The author, Charles Manning, states in this mailing that the maximum file size is 512 MB. It has been announced that Android 2.3 will use ext4.
It might be possible to format your SD card to this format as well, but I haven't tried it. Bear in mind that you won't be able to read the contents under Windows or OS X.
See also the answers in this topic.

Categories

Resources