Ionic 2/3 - 我无法从 url 下载图像

Ionic 2/3 - I can't download image from url

我在使用 url 下载图像时遇到问题。该应用程序提醒我图片已下载,但图库中没有任何内容。这是我的步骤和代码:

第一:我安装了这些插件

第 2:在 Medule 中:

import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/file-transfer';
import { File } from '@ionic-native/file';
...
providers:[
   ...
   FileTransfer,
   //FileUploadOptions, 
   FileTransferObject,
   File,
]

最后:在我的主页

 import { FileTransfer, FileUploadOptions, FileTransferObject } from 
 '@ionic-native/file-transfer';
 import { File } from '@ionic-native/file'; 
 ...
 export class HomePage {
    fileTransfer: FileTransferObject = this.transfer.create();

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

    download(imgURL){
       this.fileTransfer.download(image.img, this.file.dataDirectory + 'file.jpg').then((entry) => {
          alert('download complete: ' + entry.toURL())
       }, (error) => {
          // handle error
       });
    }
 }

所以,我的步骤有什么错误吗?

我可以通过add/edit这几个代码下载

1st:我在ts的顶部定义了cordova

declare var cordova:any;

然后:我在下载功能中做了这些改动

download(imageURL) {
    const fileTransfer: FileTransferObject = this.transfer.create();
let targetPath = cordova.file.externalRootDirectory+ "download/"+moment().format("YYYYMMDDHHmmsss")+".jpg";
fileTransfer.download(imageURL, targetPath, true).then((entry) => {
  alert('download complete: ' + entry.toURL());
}, (error) => {
        console.log("download error source " + error.source);
        console.log("download error target " + error.target);
        console.log("upload error code" + error.code);
    });
}

但我的回答还没有完成,因为图片没有保存到图库。那么,有什么帮助吗?

注意:我已经有了下载图片的路径"entry.toURL()",但是如何在图库中查看图片?