Can anyone help figure out why my app is persisting that FileOpener plugin is not installed when it actually is?
Everytime I try to open a PDF/Image/Docx/XLSX or any other file type I get a notification in the console as per below:
I followed this tutorial here line by line and when I investigate the file structure I can see that the FileOpener plugin is there, see:
In my app.module.ts:
In my user.provider.ts file:
This is my DownloadDocument function:
async DownloadDocument( location: string, name: string, mime: string, message: string = undefined )
{
var loading = await this.ShowLoading( message );
try
{
var dir = '';
if ( this.IsIOS )
{
dir = this.file.documentsDirectory;
}
else if ( this.IsAndroid )
{
dir = this.file.dataDirectory;
}
dir = `${dir}${name.replace(/ /g, '')}`;
const fileTransfer: FileTransferObject = this.transfer.create();
fileTransfer.download(`${this.APIUrl}/${location}`, dir, true)
.then( ( f ) =>
{
this.fp.open( f.toURL(), mime ).then( () =>
{
console.log('File is opened')
} )
.catch(err =>
{
console.log('Open Error: ' + JSON.stringify( err ));
});
loading.dismiss();
}, ( error ) =>
{
console.log('Download Error: ' + JSON.stringify( error ));
loading.dismiss();
} );
}
catch( error )
{
console.log('General Error: ' + JSON.stringify( error ));
loading.dismiss();
}
}
One thing to note though is that if I use the DocumentViewer plugin, it can open the PDF files. But I would like to use the FileOpener plugin as I intend to open other files other than PDFs.
Can anyone perhaps see what I am doing wrong?