Problem: I cannot seem to understand why, targeting API 30 (Android 11), my app can still upload and download from the storage\emulated...\download
folder for a variety of files all day long, but it fails every time on *.db
files... and I was able to on API 29 without issue.
Being a new app, and my first, I don't really want to depend on legacy workarounds. I would rather this work correctly from the start. This app needs to be capable of allowing the user to import and export file attachments to this app's database.
So, back to my original issue... I don't understand why using new FileInputStream(filename)
has no issue with using the same path for one file and not another? This is the only shared folder the app and user needs, it caches everything else.
Works with this file and same path
Doesn't with this file and same path
UPDATE: Added code to clarify intentions to copy.
InputStream source = new FileInputStream(sourcePath);
OutputStream destination = new FileOutputStream(destinationPath);
DatabaseManager.copyDatabase(dbSource, destination);
I can update and replace using the getContentResolver
but the same issue still persists -- working for one device and not the other.
InputStream source = getContentResolver().openInputStream(uri);