If a user requests a restore of the data I do a restore from the internal sd-card to the apps data directory with "FileInputStream" and "FileOutputStream".
This is working on Android 8 and lower, but since Android 9 it does not work anymore.
I don't get any security or other related exception.
It finished without errors, but the data (Database) is still the old one with the older entries.
This is how I write the database file:
byte[] buffer = new byte[1024];
int length;
while ((length = input.read(buffer)) > 0) {
output.write(buffer, 0, length);
}
input = FileInputStream of the path '/storage/emulated/0/appname/backupAuto_180913120029.db' output = FileOutputStream of the path '/data/user/0/packagename/databases/data.db'
output.flush();
output.close();
input.close();
UPDATE:
If I transfer after write/restore the data.db file from the device and open it via a SQLLite Tool I see the correct data.
But the app still display the old data. No matter what I do.
I am using a ContentProvider and inside getReadableDatabase() but it seems I get always a cached or an old database.