Reputation: 37
I'm currently preparing a puzzle App. however I'm in a dilemma if I should choose internal or external storage ( or any other by suggestions ). the App will contain like 30 images for the puzzle ( and an option to choose own gallery images ). I'm not a very experienced coder so the combination between best and easiest option would be great.
thanks in advance, ~Olijf
Upvotes: 2
Views: 758
Reputation: 72563
Why not set this in your Manifest:
android:installLocation="auto"
If you declare "auto", you indicate that your application may be installed on the external storage, but you don't have a preference of install location. The system will decide where to install your application based on several factors. The user can also move your application between the two locations.
Edit:
Checking, if external or internal storage is available:
boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other states, but all we need
// to know is we can neither read nor write
mExternalStorageAvailable = mExternalStorageWriteable = false;
}
Upvotes: 2