I have a large data that I have to use in my first android application, could any one guide me the best way to achieve this? Is there something like embedded database in android framework? Can i keep my database on my custom server and provide web service to my application? Which one of the above is better, since I can offer the user to purchase the application and keep the data locally on his device in compressed format. Thanks
2 Answers
You can ship an android application with the database file in the res/raw folder, and then programmatically copy the file onto SD Card. I personally compress my database file into a zip and uncompress it on first run.
Android has support for SQLite databases which is a very efficient, embedded, crossplatform database. Would recommend this.
Using a remote server might not be a good idea, since signal on wireless networks is often slow and unreliable.
See this answer for me details. Ship an application with a database
But if the file size of the compressed database is >1MB then you'll need to download it from a webserver and store it locally (Android has a 1MB file size limit on internal files/resources)
-
You could also spilt the file into smaller chunks and recombine programically, but this is more awkward – Kurru Sep 08 '11 at 14:49
Here are some brief thoughts.
Android has SQLite, you could use that for storing and accessing data. But there are restrictions on such file sizes of 1mb. I'd recommend setting up a simple web server that can accept GET requests.

- 30,811
- 34
- 116
- 155
-
This is not true. You can have a DB of any size. The restriction of 1MB is about a file in the assets folder. As Kurru wrote, you can split your db file into smaller chunks. But anyway a webservice should not be seen as an alternative to a local database. – Yar Feb 17 '12 at 15:02