Reputation: 18825
so this is a follow up to this question (Ship an application with a database)
Looking at that question I see only 3 ways I can think of to get a SQLite database in Android.
So it would seem to me that with solution 1 and 2, you are going to be consuming double the amount of disk space. Solution 1 means replicating the database and Solution 2 means having a database but also having to store a script to script the data in (which'll probably be just as large as the database).
I would try solution 3 but I don't have anywhere to put a database that can be freely accessed from the web and plus I'm new at Android, and I don't really know how (maybe in a few weeks).
So just wondering, is it true that unless I go with solution 3, any android app that requires a database at install time requires twice as much initial space as the initial populated data? Is there any other solution to get around this?
Upvotes: 1
Views: 202
Reputation: 1006809
So it would seem to me that with solution 1 and 2, you are going to be consuming double the amount of disk space.
The APK file, being a ZIP file, is compressed, so "double" may be overstating the case. But, yes, it will consume some extra disk space.
Solution 1 means replicating the database
If by "replicating" you mean "copying", yes. SQLiteAssetHelper
handles this for you.
I would try solution 3 but I don't have anywhere to put a database that can be freely accessed from the web
If you are planning on distributing through the Play Store, you need a Web site in order to market and promote the app, in which case you can host your database on your own Web site.
If you are planning on distributing through your own distribution channels, you need a Web site in order to host the APK itself for download, in which case you can host the database there as well.
If you are not planning on distributing the app, there's little point in worrying about the space consumption, as it will only affect you.
Is there any other solution to get around this?
If you plan to exclusively distribute via the Play Store, you could look at expansion files. You will still need download logic, but sometimes the Play Store will download the file for you.
Upvotes: 4