I have an android app with a lot of media files. The files have to be user-updatable, so I can't put them in the resources. I have been having to use a bash script to use adb and push out my test files every time I recompile. Is there any way to package the media so that it is installed to the applications file directory (on the SDCard if the app is installed on the SDCard, and internal if the app is installed internally) when the package is installed?
+2
A:
How about putting them in resources and them copying them to storage when app is run for the first time?
You can use this code to check that the app is run for the first time:
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(this);
boolean firstRun = pref.getBoolean("pref_first_run", true);
pref.edit().putBoolean("pref_first_run", false).commit();
Peter Knego
2010-10-23 15:45:00
+2
A:
Copying the files out to SD on the first application start is one way of doing things, although you'll end up storing the default files twice on the user's phone, which they may not appreciate if the files are quite big.
Another option is to have the application download the files from the web. It'll mean a bit of a wait for the user, but the initial application will be quicker to download in the first place, and depending on your application you may be able to run the download asynchronously in the background before the files are actually needed.
Nick
2010-10-23 16:02:34