Unable to save a pdf file using ionic file transfer plugin

I m using ionic 5+ and using ionic file transfer plugin for downloading a pdf file but whenever i m downloading a file im facing 2 issues

  1. When ever im building a project i need to manually remove the deprecated one to this
    public class FileProvider extends androidx.core.content.FileProvider

  2. After i changing this and ran the application im getting 401 error

below is my code

pdfUrl = 'https://www.cs.toronto.edu/~hinton/absps/NatureDeepReview.pdf';

  constructor(private transfer: FileTransfer, private file: File) {}

  download() {

    const fileTransfer: FileTransferObject = this.transfer.create();

    const url = this.pdfUrl;

  fileTransfer.download(url, this.file.dataDirectory).then((entry) => {

    console.log('download complete: ' + entry.toURL());

    this.saveData = entry.toURL();

  }, (error) => {

    // handle error

    console.log(error);

  });

is there any alternative for this and if i want to use capacitor where can get a sample related file download