My ionic app downloads a PDF file and then tries to open it using Cordova FileOpener2 plugin:
var targetPath = "file:///storage/emulated/0/Android/data/myapp/files/myDir/fds/30510L109.pdf";
$cordovaFileOpener2.open(targetPath, 'application/pdf')
.then(function() {
// file opened successfully
},
function(err) {
util.logObject(err, "Open error");
});
but I get this error:
An error occurred: "file:///storage/emulated/0/Android/data/caliatys.edata/files/E-data/certificates/9360432001-H44K95L-en.pdf exposed beyond app through Intent.getData()"
EDIT
After some research and debug, I've found that this exception is thrown: FileUriExposedException. It seems to be a change introduced in Android SDK 24 (link)
I read this solution: link, but I already use cordova.file.externalDataDirectory to save my PDF...