Anders Sewerin Johansen
Anders Sewerin Johansen

Reputation: 1656

Shipping a (huge!) SQLite3 DB with Android app

I need to ship an app that uses read-only access to several preexisting SQLite3 DB's that each are a couple of 100MB's, total combines size > 1GB. The databases are created on a Mac, and are currently used in a shipping iOS app. I am pretty proficient in Java, but new to Android.

This leads to the following questions:

1) Will I need to modify the databases? I only plan to use them with SQLiteDatabase::rawQuery queries, so no nee for bindings and metadata I hope.

2) It it really correct that even if the DB's will only be used as read-only, I'll have to copy them out of the app bundle or download them to user directory on first start-up?

3) The queries can be slow. I want to run them in a thread and provide data via a callback. Is this done the way it's done in normal Java (Runnable/Thread), or will I have to use another method?

4) Is there anything else that's obvious to the Androidan that I have clearly missed?

Upvotes: 0

Views: 167

Answers (2)

Dazzy_G
Dazzy_G

Reputation: 819

1) No, it should work fine.

2) Yes, if you want to ship an APK that is over 50Mb you will need to use an expansion file.

3) For easy background tasks with a call back you could use an ASyncTask.

Upvotes: 1

owen gerig
owen gerig

Reputation: 6172

for a decent example of a sqlite helper class look here

  1. you shouldnt need to edit the database. my sqlite databases work the same wether I access them via sqlite3 or with the android my sqlite helper class

  2. once you copy them you can read and write

  3. not really sure about this answer. i will say though that the database helper class above seems to work just fine (fast) but my db is smaller (500kb)

  4. dont think so

Upvotes: 1

Related Questions