I have 7mb app that consumes 25mb once the sqlite db is copied to the data/data/packagename/database folder. This is too big on my frugal emulator and potentially offensive to users.
Is there a way to put the sqlite db straight onto the sdcard? Or the whole app et al? Asking users to force it across after installation seems too little too late and i can't host the dayabase myself.
Is there a way to put the sqlite db straight onto the sdcard?
You could probably make a mod to SQLiteAssetHelper
to handle this. By default, it will place the database in the normal spot on internal storage. Unfortunately, right now, it would require some non-trivial surgery to make this change, though I have just filed a feature request to make that a bit easier.
Or the whole app et al?
You can use android:installLocation="preferExternal"
, though it may not be honored. And, that will not affect your database -- getFilesDir()
, getDatabaseDir()
, and kin are always on internal storage.
Also note that this is all really only an issue for Android 1.x/2.x devices. Everything newer than that should consider internal and external storage to be on one partition, so they share space.