Was just wondering if there is a suggested approach when working with a existing data with StorIO? I will like to ship my app with a lot of existing data. Should I copy my .db from assets to db folder on first launch or is there anything better I can do? Thanks!
Asked
Active
Viewed 795 times
1 Answers
1
- Create prefetched SQLite database.
- Put created db file into
assets
folder. - Write custom
SQLiteOpenHelper
where you should copy db from assets folder to thedb
folder of the application data at first time when it's opened. Or you can use Android SQLiteAssetHelper library. - Pass your
SQLiteOpenHelper
orSQLiteDatabase
to theStorIOSQLite
.
StorIOSQLite storIOSQLite = new DefaultStorIOSQLite.Builder()
.db(yourPrefetchedDb)
// add types mappings if you need
.build();
That's the easiest way :)
May be you can download data from remote source (server) instead of placing it into the assets?
Because prefetched database will be part of the apk and increase its size and you can not remove this file at runtime.

Artem Zinnatullin
- 4,305
- 1
- 29
- 43
-
Thanks! was just thinking about the SQLLiteAssetHelper library. I cant download from remote source, its one of those rares apps designed to work in the "field" where internet access is scarces. – PiXeL16 May 18 '15 at 19:40
-
Oh, I understand. Good luck with it! – Artem Zinnatullin May 18 '15 at 22:06