Ionic file download not working in native app but working in web app (browser)

Hi All,

I am just checking on any file download from server.

Below code is working on browser but not in APP.
Seems that below code not working

document.body.appendChild(downloadLink);
downloadLink.click();

My full code:-

downloadFile(directory: string, filename: string = null): void {

    const baseUrl = this.service.Base_Url + 'download.php?dir=files/' + directory + '/&file=' + filename;

    this.service.process_download(baseUrl).subscribe(

      (response: any) => {

        //Check Blob size | File is available or not

        if (response.size > 0) {

          let dataType = response.type;

          let binaryData = [];

          binaryData.push(response);

          let downloadLink = document.createElement('a');

          downloadLink.href = window.URL.createObjectURL(new Blob(binaryData, { type: dataType }));

          if (filename) {

            downloadLink.setAttribute('download', filename);

          }

          document.body.appendChild(downloadLink);

          downloadLink.click();

        }

      }

    )

  }

Please suggest on this.

I would like to see both Base_Url and process_download.

@rapropos , Thanks for reply again.

public process_download(url: any) {    

    if (this.Base_Url != undefined) {

      return this.http.get(url, { responseType: 'blob' });

    }
  }

Base_Url is server URL, Below is the download.php script

//Download function starts from here
    $varFilePath = SOURCE_ROOT . $varDir . $varFile;
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Type: application/force-download");
    header("Content-Disposition: attachment; filename=" . $varFile);
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: " . filesize($varFilePath));
    header("Content-Description: File Transfer");
    @readfile($varFilePath);
    exit();

I guessed that much. I want to know what it is. Specifically, I want to know that it starts with https://.

yes this starts with https://

@rapropos waiting for your reply

Please suggest, I am waiting for reply.