Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Is there a technical reason for why apps that only need their own data are not limited to one folder? I do realise that some apps use other apps' data, but I'd be much more likely to install an app that only asked for permission to store files in one, specific folder.

share|improve this question

3 Answers 3

up vote 1 down vote accepted

There are different mechanisms to store data in an Android application that don't need the SD card access permission. You can create databases, store application parameters, create files on the internal storage. All these will not require any specific permissions and these data are accessible only by the application that created them.

On the other side, if an application needs the SD card permission it may be because it as a very large amount of data to store or that it wants to modify/add/remove files such as in a file manager. But for important application specific data, the SD card if not recommended because it could be removed at anytime (or mounted as a USB drive) and not available to the applications.

I think a lot of applications that ask SD access permission could use another type of data storage that would not require that. Moreover, files created on the SD by an app will not be removed upon un-installation of the app but all other types of internal data storage will be. So to me it would be a better development practice not to use the SD if not required, and as you mentioned it would not scare people away like apps that access the whole SD.

share|improve this answer

SD cards generally use the FAT file system, which does not allow for filesystem permissions. This means that the Android OS would have to manage a custom list of files, their permissions, a mapping of apps to files/folders, etc. in order to prevent apps from accessing the whole card. This would be a terrible mess. Not only complicated, but it would require a lot of storage space. And then one day you take out your SD card and remove some pictures, and the entire system breaks. You get the idea.

share|improve this answer
3  
I don't see how caging an app's file-system access would be such a mess, and especially not how removing some pictures would break it. –  user2774 Mar 2 '11 at 19:48
    
Well removing files wouldn't necessarily break it, if the management was sufficiently complex. But adding files would be a problem. Allowing just any app to access the new files is a problem, and disallowing any makes the files useless. You could have a specific dropbox folder, which again makes the management more complex. But how do you force someone moving files onto the card from their PC to use the dropbox folder? You can't. You could again make the management more complex, and have it move any new files to the dropbox. But there will always be another way to break it. –  Matthew Read Mar 2 '11 at 19:57
5  
Removable media is designed to be removed and altered by other devices, and thus attempts to manage it are basically useless. Would you expect Windows/Linux/MacOS to prevent individual apps from accessing an SD card plugged into your phone? Would you want to set up which of your 100's of apps can access what parts of the card? It's much easier to just not put important stuff on the SD card if you're going to install random untrusted apps. Rant done :P –  Matthew Read Mar 2 '11 at 19:59

As Matthew Read has explained, with a normal SD card using the FAT file system, it's not possible to use the file permissions to control apps' access, the same way that Android controls their access to files on the internal filesystem. But now that Android phones use internal storage instead of SD cards, and they use MTP to offer access over USB instead of the mass storage device class, Android phones are free to use better filesystems for their large data storage.

KitKat added a new mechanism for apps to store large files. In the internal USB storage, each app gets a private data directory, just like in the smaller device memory. (On some devices, these might even be the very same filesystem.) Apps can access their private directory on this filesystem without needing any special permissions. It's also now possible for apps to only ask for the "read SD card" and "write SD card" permission on versions of Android prior to KitKat, if they only need the SD card in order to use a private directory like this.

The old shared directories like "Downloads", "Music", and "Notifications" are still present just like before, and still need those same permissions for access. Old apps that haven't been updated for KitKat will still use those directories, not the new, private directories.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.