I'm experiencing crashes on some devices when using SQLiteAssetHelper in my app, most of all on OnePlus devices. Now I read here that it has to do with the directory the database is stored.
Now I'm trying to find a workaround, the best I could come up with currently is a constructor like this
public MySubclass(Context context) {
super(context, databaseName, context.getFilesDir() + "/databases", null, databaseVersion);
Is this the correct way to do it or are there other problems with this approach?
EDIT
The exception is
Fatal Exception: android.database.sqlite.SQLiteException: Can't upgrade read-only database from version x to y: /data/data/my.package.id/databases/database.db
Sorry, I linked the wrong SO-question: this is the correct one. There it says 'OnePlus is able to copy the database to /data/data/package-name/databases/filename.db but it doesn't allow to access that data and i have no clue regarding that.'
The SQLiteAssetHelper constructor allows you to specify your own database destination path (the folder needs to be writable). If you don't specify any it is using one by default. See this excerpt from the Github repo: