Mark, Is the Android Dev Guide not correct?
The Android Dev Guide makes this claim: public static File<http://developer.android.com/reference/java/io/File.html> getExternalStorageDirectory () Since: API Level 1<http://developer.android.com/guide/appendix/api-levels.html#level1> Gets the Android 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()<http://developer.android.com/reference/android/os/Environment.html#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.* In devices with multiple "external" storage directories (such as both secure app storage and mountable shared storage), this directory represents the "primary" external storage that the user will interact with. Applications should not directly use this top-level directory, in order to avoid polluting the user's root namespace. Any files that are private to the application should be placed in a directory returned by Context.getExternalFilesDir<http://developer.android.com/reference/android/content/Context.html#getExternalFilesDir(java.lang.String)>, which the system will take care of deleting if the application is uninstalled. Other shared files should be placed in one of the directories returned by getExternalStoragePublicDirectory(String)<http://developer.android.com/reference/android/os/Environment.html#getExternalStoragePublicDirectory(java.lang.String)> . On Fri, May 11, 2012 at 1:12 PM, JediDroid wrote: > Mark, > > Thank you for your comment. > > I should have clarified what I'm trying to do. > > As part of an app I'm developing it will store *User Created files* on > the SD card if it is available. > If the SD card is not available, it will store the files on the devise > Internal Flash if it is available. Also, these User Created files must be > stored in a location where they will not be deleted by the system when the > app is uninstalled,. > > The Android Dev Guide tells me to store files in one of the public > directories on the external storage. But I am confused on what code to use > to access the devise internal storage. > > I'm developing this app using API Level 8. > > Please see the reference information below at this link: * > http://developer.android.com/guide/topics/data/data-storage.html* > > *Saving files that should be shared* > If you want to save files that are not specific to your application and > that should not be deleted when your application is uninstalled, save them > to one of the public directories on the external storage. > > See: getExternalStorageState() > See: getExternalStoragePublicDirectory() > > > Thanks for your help. > > > On Friday, May 11, 2012 11:23:24 AM UTC-7, Mark Murphy (a Commons Guy) > wrote: > >> getFilesDir(), I suppose. >> >> On Fri, May 11, 2012 at 2:21 PM, JediDroid wrote: >> > >> > Hello, >> > >> > I know the "if statement" section of the code below is successful for >> > accessing the sd card when its mounted. >> > >> > Please tell me what code to use in the "else if statement" section to >> access >> > device internal storage (internal flash storage)? >> > >> > My code: >> > >> > String state = Environment.**getExternalStorageState(); >> > >> > if (Environment.MEDIA_MOUNTED.**equals(state)) { >> > >> > // Try to make directory on the SDcard. >> > subdirectory = >> > Environment.**getExternalStoragePublicDirect**ory("MyDirectory"); >> >> > >> > // Make sure the directory exists. >> > subdirectory.mkdirs(); >> > >> > } else if (-- What code to use here to access device internal storage? >> --) { >> > >> > // What code to use below to access device internal >> storage? >> > >> > // Is this the correct code to make a directory on device internal >> storage? >> > subdirectory = >> > Environment.**getExternalStoragePublicDirect**ory("MyDirectory"); >> >> > >> > // Make sure the directory exists. >> > subdirectory.mkdirs(); >> > >> > } else {} >> > >> > >> > Reference to using the methods: >> > getExternalStorageState() and **getExternalStoragePublicDirect**ory() >> >> > http://developer.android.com/**reference/android/os/**Environment.html# >> **getExternalStorageState()<http://developer.android.com/reference/android/os/Environment.html#getExternalStorageState()> >> > >> > >> > Thank you for your help. >> > >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Android Developers" group. >> > To post to this group, send email to android-developers@** >> googlegroups.com <android-developers@googlegroups.com> >> > To unsubscribe from this group, send email to >> > android-developers+**unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> >> > For more options, visit this group at >> > http://groups.google.com/**group/android-developers?hl=en<http://groups.google.com/group/android-developers?hl=en> >> >> >> >> -- >> Mark Murphy (a Commons Guy) >> http://commonsware.com | http://github.com/commonsguy >> http://commonsware.com/blog | http://twitter.com/commonsguy >> >> Android Training in DC: >> http://marakana.com/training/**android/<http://marakana.com/training/android/> >> > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en