cordova-plugin-fileopener icon indicating copy to clipboard operation
cordova-plugin-fileopener copied to clipboard

exposed beyond app through Intent.getData()

Open san0suke opened this issue 8 years ago • 9 comments

window.cordova.plugins.FileOpener.openFile("file:///storage/emulated/0/Download/nf.pdf", function(r) {
    console.log("sucesso:", r);
}, function (r) {
    console.log("erro:", r);
});

erro: file:///storage/emulated/0/Download/nf.pdf exposed beyond app through Intent.getData()

san0suke avatar Jul 17 '17 19:07 san0suke

Hi,

it seems to be an Android N-related issue as explained here and here.

Two solutions:

  • change your targetSdkVersion to 23 or lower. It is the easiest solution, but it's only a workaround for now
  • follow the recommendations in the blog post, but it requires modifications in the cordova-plugin-fileopener (you're welcome to submit a pull request) and some configurations in your app (AndroidManifest.xml and res/xml/provider_paths.xml)

Regards

marob avatar Jul 18 '17 08:07 marob

@marob solution #1 worked, thanks

jodacame avatar Mar 18 '18 01:03 jodacame

Hi,

it seems to be an Android N-related issue as explained here and here.

Two solutions:

  • change your targetSdkVersion to 23 or lower. It is the easiest solution, but it's only a workaround for now
  • follow the recommendations in the blog post, but it requires modifications in the cordova-plugin-fileopener (you're welcome to submit a pull request) and some configurations in your app (AndroidManifest.xml and res/xml/provider_paths.xml)

Regards

Thank you so much for the suggestions! Both solutions worked!

  • Solution 1: change AndroidManifest.xml file android:targetSdkVersion="23" and clean & rebuild.
  • Solution 2: Found a PR does exactly what the blog post described. https://github.com/chingfeng/cordova-plugin-fileopener/commit/474a4cb11941ac17782e099a023c7d57cc110f50

frankvlocity avatar Dec 24 '18 06:12 frankvlocity

Indeed the https://github.com/Smile-SA/cordova-plugin-fileopener/pull/18 PR is pending as I have no time nor any project to test it against. I could merge it but it seems risky without further testing.

marob avatar Jan 02 '19 15:01 marob

if targetsdk version is 29 what can i do?

parshwa1596 avatar Jan 22 '20 12:01 parshwa1596

if targetsdk version is 29 what can i do?

You can try to use https://github.com/chingfeng/cordova-plugin-fileopener/commit/474a4cb11941ac17782e099a023c7d57cc110f50

marob avatar Jan 22 '20 12:01 marob

Either the https://github.com/chingfeng/cordova-plugin-fileopener/commit/474a4cb11941ac17782e099a023c7d57cc110f50 version is not working, or you're not really using this version (make sure you clean and rebuild).

marob avatar Jan 22 '20 12:01 marob

if targetsdk version is 29 what can i do?

You can try to use chingfeng@474a4cb

not solve using these solution.

parshwa1596 avatar Jan 23 '20 05:01 parshwa1596

hi i got profile pic in pdf what can i do?

parshwa1596 avatar Jan 24 '20 05:01 parshwa1596