سؤال

I check whether external storage is mounted and available for read/write, and then I read from it. I'm using the exact official Android sample code (from here).

It says external storage is not mounted. getExternalFilesDir(null) returns null.

First, I experienced it with a HTC One V that had no external SD card inserted (but has a large storage internally).

Now, I'm experiencing the same on a WayteQ xTAB-70dci tablet, which has a huge "internal SD card" (this is how the tablet calls it), but no external SD card inserted.

In both cases, the standard Android APIs (getExternalStorageState(), getExternalFilesDir() etc.) return false.

I'm absolutely fed up. Obviously, users who pay for my app (game with much graphics) will expect it to be installed properly on their phone/tablet having a huge internal SD card (like the WayteQ).

What is wrong here? Why do these devices (HTC, WayteQ, come on!) point to ext SD card (which is usually missing by default from the product) instead of their huge internal SD storage? Absolutely illogical and even harmful. What can I do, is there a standard workaround to this?

هل كانت مفيدة؟

المحلول

As said it's up to the device manufacturer. I do believe the trickery with internal/external storage points does Samsung on their phones.

In addition to checking if external is available you'd have to check /data directory size to see if you can cache your app on the internal part. See here. I assuming you are downloading rest of the app on request anyway due to filesize limits, right?

Bonus info: This shouldn't really bother you much, but as a good developer you may take this into account too. Some people use CronMod scripts that will mount different folders under external storage. So they have more space. Great, right? Problem arises when you use different version and /data/data is on the SD (which on the phone appears as a larger internal memory) but /data/cache is still on the internal for speed. Suddenly you may have no real, hard data about internal size of cache available to you. But then again, this is done by the power users mostly, which ought to have an inkling about what is up.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top