I am using Apache Cordova with cordova-plugin-file to develop some android app. Since Android API 29 (Android 10), apps no longer have access to shared space directly due to privacy issues.
I was storing some pdf file on file:///storage/emulated/0/Download/ from where the user could then open the pdf file.
window.resolveLocalFileSystemURL('file:///storage/emulated/0/Download/', function (dir) {
dir.getFile(filename, { create: true }, function (file) {
file.createWriter(function (fileWriter) {
console.log('Writing content to file')
fileWriter.onwriteend = function () {
console.log('Successful file write...')
}
fileWriter.onerror = onerror
fileWriter.write(DataBlob)
}, onerror)
}, onerror)
}, onerror)
But that stopped working on Android 10.
How can I store now a file to be accessible by the user?