views:

2286

answers:

4

Hello,

I'm trying to find information on how to programmatically access the HTC Droid Incredible's supposed 8GB of internal storage.

To determine the external storage (SD Card) location, I'm using android.os.Environment.getExternalStorageDirectory().

I've not been able to find any corollary for internal phone storage.

In examining HTC/Google Nexus One, Motorola Droid, and HTC Dream/G1 phones, there (as would be expected) does not appear to be any mount point for such arbitrary internal storage. On these phones the internal storage is divided amongst /data, /system, and /cache partitions. The Incredible's internal storage is certainly not going to be located in /system. /cache is also unlikely given that it is globally non-readable/non-executable. I'd read in reviews that the phone will still be limited to 512MB or so for apps, suggesting that it is not simply a subdirectory of /data.

Any suggestions would be greatly appreciated. I do not have access to a Droid Incredible unit myself, of course.

+2  A: 

As you're aware access to internal storage is usually limited to certain directories for each application by permissions. This is to stop one application reading data from another and from accessing system files without using the APIs. This makes sense since, for example, if you had an internet banking application you wouldn't want other apps to be able to access any of its cached data.

Each application gets to store data in a directory under /data/data. However, normally you don't specify the paths explicitly but used methods like Context.openFileOutput() which creates the file in the appropriate subdirectory of your application's directly.

I agree with you that it is unlikely that the majority of the 8GB of the Incredible's storage will be used for the /data partition.

So if they are going to have a separate partition to allow music and photos to be stored easily on the phone's internal storage then they will have to do it in a way that's compatible with existing applications. This means using Environment.getExternalStorageDirectory() but since the Incredible also supports SD cards then you're right in that it's not obvious how this might work.

There is a thread on the Android Developers Google Group discussing this exact question. Whilst there isn't an answer (at the time of writing) for how the Incredible works there's a post which says the Samsung Galaxy solves the same problem in this way:

  • The internal storage is mounted at /sdcard
  • If an SD card is also available this can be found at /sdcard/sd

This seems a sensible solution since it will be compatible with existing applications, including those which have mistakenly hard coded /sdcard instead of using Environment.getExternalStorageDirectory().

So my advice would be to use Environment.getExternalStorageDirectory() when you're looking for large areas for storage - either SD card or internal to the phone - and hope that each phone returns something sensible.

Dave Webb
+2  A: 

There is more information here: Droid Incredible storage mount points. It seems that Droid Incredible mounts its internal storage to /emmc, supposedly mounted r/w. It is not yet verified whether the WRITE_EXTERNAL_STORAGE permission is necessary in order to gain r/w access - I'm trying to get this information at http:// code.google.com/p/aedict/issues/detail?id=86

I will probably solve this by allowing the user two options to store the data:

  1. SD-Card
  2. Droid Incredible-only Internal storage

Edit: It seems that the WRITE_EXTERNAL_STORAGE permission is sufficient: according to http://www.droidforums.net/forum/droid-incredible-hacks/50916-how-i-rooted-my-incredible-installed-busybox.html both /sdcard and /emmc has the same GID of 1015.

Edit2: According to http://groups.google.com/group/android-developers/browse_thread/thread/45d96f07abd83549/42d5ec430b2f7572?lnk=raot the Incredible returns /sdcard as the result value of Environment.getExternalStorageDirectory(). Therefore, the user needs to decide whether he wants to use /sdcard or /emmc. The autodetection of Incredible may be based on existence of the /emmc path.

Martin Vysny
A: 

so quering INTERNAL_CONTENT_URI give me read access to the media on incredible internal storage ? I just want to display data

Tee
A: 

To be quite honest, the internal storage is a joke. Just think of it as a flash drive that you can't access from the phone. For example, I'll hook it up to my computer & store movies on it to transfer to someone else's computer. There's no way for me to watch those movies from the phone. It's super lame. I've had issues with this phone from Day 1.

KTpie