pilgr / Paper

Paper is a fast NoSQL-like storage for Java/Kotlin objects on Android with automatic schema migration support.
Apache License 2.0
2.34k stars 234 forks source link

Prepackage database #161

Closed js-commit closed 5 years ago

js-commit commented 5 years ago

Hi,

I'd like to ship my app with a Paper DB already loaded with data. How would it be possible to do that? I imagine you'll need to

  1. Create the database with the data in the Android application.
  2. Write the file location to local storage (save as backup) to sd card
  3. Copy that db file to your /res folder in Android app
  4. Upon app initialization the db, copy the file to a location where Paper can read the db.

I am not sure if this is feasible, esp for parts 4.

pilgr commented 5 years ago

It should be totally feasible. Just make sure you recreated the whole path where paperdb file was located.