Internal / External Storage, External SD Card Storage
Hi,
on Android devices, you have the Internal Storage and the External Storage. Often the 'External Storage' isn't external at all, since it represents flash memory that cannot be removed by the user. Then again, some devices provide the ability to add additional storage, for example an external (removable) SD card storage.
My question is not about where to install an app. My question is how to handle the storage of data.
As it seems, the following flash code
File.applicationStorageDirectory.resolvePath(fileName).nativePath
returns a path to Internal Storage. This is not a good idea, since many Android devices only have very limited 'Internal Storage' - even modern devices only have few hundred MB (the upcoming Archos 101 for example, but even the expensive Galaxy Tab only has around 2 GB!).
In my application, I would like to have the storage directory located in the 'External Storage' if the app is running on Android.
My question is: How can I identify the existence of 'External Storage'? The native Android docs say, you should use getExternalFilesDir, see the following excerpt (taken from http://developer.android.com/guide/topics/data/data-storage.html)
<<<<
If you're using API Level 8 or greater, use getExternalFilesDir() to open a File that represents the external storage directory where you should save your files. This method takes a type parameter that specifies the type of subdirectory you want, such as DIRECTORY_MUSIC and DIRECTORY_RINGTONES (pass null to receive the root of your application's file directory). This method will create the appropriate directory if necessary. By specifying the type of directory, you ensure that the Android's media scanner will properly categorize your files in the system (for example, ringtones are identified as ringtones and not music). If the user uninstalls your application, this directory and all its contents will be deleted.
If you're using API Level 7 or lower, use getExternalStorageDirectory(), to open a File representing the root of the external storage. You should then write your data in the following directory:
/Android/data/<package_name>/files/
The <package_name> is your Java-style package name, such as "com.example.android.app". If the user's device is running API Level 8 or greater and they uninstall your application, this directory and all its contents will be deleted.
>>>>
Please advice how we can do similar things from AIR.
Thanks alot
LLD
