Android Room and Expansion File
Android Room and Expansion File
Is it possible to use Android Room with a database file as part of an expansion file instead of Assets?
I was just wondering because I have a large preloaded database and I want to save as much storage as possible. If I put the database in the Assets file, I cannot remove it from the APK, so I have both the database data duplicated in the APK and the database file in the device storage.
1 Answer
1
Yes, it is possible. Just make sure to copy the database file to the getDatabasePath folder, and do not overwrite it if it is already there.
Also, make sure the database file is copied before AppDatabase create.
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.