Reputation: 5173
Please excuse me if this was already explained.
I am using file path as
Environment.getExternalStorageDirectory()+"/myfolder/myfile.img
for storing file with manifest permissions .It is working fine for me .
I have some queries regarding this line of code.
I noticed that this creates a folder in internal memory, what about if there is no enough space in internal memory?
And what about if there is enough memory in external SD card?
Thanks in advance.
Upvotes: 1
Views: 122
Reputation: 2853
Take a look at: http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory()
Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer.
Depending on the device your file will be placed on the sdcard or the internal storage.
If no free space is available any IO action which writes data will fail.
Upvotes: 0
Reputation: 510
From here: http://developer.android.com/reference/android/os/Environment.html#getExternalStorageDirectory()
Return the primary external storage directory. This directory may not currently be accessible if it has been mounted by the user on their computer, has been removed from the device, or some other problem has happened. You can determine its current state with getExternalStorageState().
Note: don't be confused by the word "external" here. This directory can better be thought as media/shared storage. It is a filesystem that can hold a relatively large amount of data and that is shared across all applications (does not enforce permissions). Traditionally this is an SD card, but it may also be implemented as built-in storage in a device that is distinct from the protected internal storage and can be mounted as a filesystem on a computer.
1) you app crashes if you not catching exceptions
2) sames as 1.
3) no!
Upvotes: 1