Update an (native) android app with a new version in Flutter while keeping the database

谁说我不能喝 提交于 2021-01-27 05:29:37

问题


I have a small application for android written in java, I am rewriting using flutter.

Is it possible to transition to the new version by keeping the SQLite database structure intact, including all data?

I ran a test, and although I was able to overwrite the application, the data was lost after upgrade.


回答1:


If anyone needed it, I was able to read the data from the existing database and write to it using flutter.

My previous test had gone wrong because the bases were allocated in separate directories.

In java, I had created the database using the SQLiteOpenHelper class, while in the new flutter application I tried to connect using getApplicationDocumentsDirectory().

I just changed the access path, and it's all settled :)

var databasesPath = await getDatabasesPath (); String path = join (databasesPath, "database.db");



来源:https://stackoverflow.com/questions/52107772/update-an-native-android-app-with-a-new-version-in-flutter-while-keeping-the-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!