vmg
vmg

Reputation: 10566

How to distribute Android app with DB data?

I'm writing my first serious Android App, which basically is interface to three DB tables. Data in those tables are predefined by me, so, user should install those app with those data. What is the best way to include those data in application package? Maybe there is a way to embed SQLite into my application distribution? Or is the only way is to define array of "insert into" strings somewhere in class and execute them to fill internal SQLite storage? Would appreciate any recommendations.

Upvotes: 2

Views: 801

Answers (2)

Romain Piel
Romain Piel

Reputation: 11177

I am currently doing the same thing in my app. Having a sqlite database file in my assets folder and copying it into the SD card at startup if it's not in there. There's a nice tutorial there and I use part of its code.

Upvotes: 1

Vincent Mimoun-Prat
Vincent Mimoun-Prat

Reputation: 28541

Put the database file in your assets and then copy it over to your application's data directory.

Your can check out this tutorial

Upvotes: 1

Related Questions