Atrix external storage functions return internal sdcard and not removable sdcard
I have a large (50 meg) download that I want to load to the sdcard if is mounted. If there is no sdcard, I download it to internal storage. I check for space available in both cases.
My code works great on the emulator and my Droid 2. My Atrix is a different story.
The Motorola Atrix has a built in sdcard. It can also have an external sdcard. The directories are mnt/sdcard and mnt/sdcard-ext. When checking external storage state, Environment.MEDIA_MOUNTED is always returned. When using Environment.getExternalStorageState(), Environment.MEDIA_MOUNTED is always returned. The standard external storage functions ignore the removable sdcard.
Is this unique to the Atrix? If not, do the other devices use sdcard-ext for the removable sdca开发者_如何学运维rd?
I really don't want to start coding for specific devices...
Android has a requirement that every device has an "shared" storage with a capacity of at least 1GB, that is mounted right out of the box, and it must be mounted to /sdcard
(or at least symlinked from /sdcard
). See section 7.6.2 of the Compatibility Definition Document, the most recent version of which is linked from here.
So the manufacturer has the option of A. bundling a 1GB or higher SD card with each device, physically inside the device's SD card slot when it's in the box or B. partitioning the internal storage (or including a secondary internal storage) to provide at least 1GB "shared" storage, and mounting this at /sdcard
. If there's a real SD card slot then this has to be mounted somewhere else.
Many manufacturers seem to choose B.
I guess the APIs that talk about "external storage" really mean "shared storage" in the CDD's terminology, and because of these requirements the "external" storage often isn't really external.
Yes, I know the SGS uses mnt/sdcard for its "internal" storage and mnt/sdcard-ext for its secondary card.
精彩评论