FileOpener (Ionic 2 - Android 6.0)

Hello, we are making an app with ionic 2, which uses the plugin of file opener, is running with versions of android less than 6.0, when running it in higher versions throw the following error: file:///storage/emulated/0/PV-2016-00003786-%20%20%20-AAMVUNO.pdf exposed beyond app through Intent.getData()
, I was reading online, I would have to add a provider in The android manifest, but I still do not work, I rely on the following link:http://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed

I attach the code

       createDocAndDisplay(documento:Blob, numeroSADE:string){
        File.writeFile(cordova.file.externalRootDirectory,`${numeroSADE}.pdf`,documento,true).then(t=>{
          FileOpener.open(cordova.file.externalRootDirectory + numeroSADE + '.pdf','application/pdf').then(()=>{
          }).catch(err=>{
            console.log('Error al abrir el archivo con el plugin fileOpener', err);
          });
        })
        .catch(err=>console.log('Error al crear el documento obtenido',err));
      }

i am using fileopener2 and it is working like charm

bengtler
I’ve readed the documentation again, followed the example from github, “how to open a pdf with file opener” and it gives an error with android version 6.0 or above.

And throws the same error:
File: ///sdcard/Download/pdf.pdf exposed beyond app through Intent.getData ().

Could you give me a hint to solve this?? Thanks in advance.

and using a lower target sdk like 23 is not an option for you?

Sadly, I’m not allowed to choose the SDK. Becouse I have clients that use the SDK version from 16 to 25.

but if you set min and targetsdk does not mean, it will not work on newer ones :wink: