Can I ship an android app, with a pre-populated objectbox db in it

前端 未结 1 1517
被撕碎了的回忆
被撕碎了的回忆 2020-12-20 00:52

Pretty much as the title says.

I want to launch my Android app, using ObjectBox, but I\'d like the data to be prepopulated in the boxes.

Can I package both

1条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-20 01:47

    As to the original question: yes, you can ship your app with an initial data file. You can prepare an ObjectBox database with all the data you need and then grab the data.mdb from the db director (default name is "objectbox").

    The BoxStoreBuilder offers the overloaded method initialDbFilethis:

    initialDbFile(java.io.File initialDbFile)

    initialDbFile(Factory initialDbFileFactory)

    Thus, you can either provide a File or an InputStream.

    0 讨论(0)
提交回复
热议问题