Image Download


#1

For a part of the app I’m currently creating I need to create a component to download an image so that it can be viewed in the phones gallery when offline and not using the app. Currently I have code that looks like this:

fileTransfer.download(image, cordova.file.externalApplicationStorageDirectory + dashName + ".jpg").then((entry) => {
      this.showAlert1('Image downloaded');
    }, (err) => {
      this.showAlert2(err);
    })

I’m aware that iPhone has a different directory structure but I only have an android to currently test on. My issue is that when testing on my Samsung Galaxy S6 if I store the image in cordova.file.externalApplicationStorageDirectory it saves to my phone but you can only view the image if you navigate to ‘Device Storage’/Android/data/appname/ and if I use cordova.file.dataDirectory then I can’t find the image anywhere.
Can anyone help me with downloading an image from an external url and saving it to device so it can be seen in gallery.
Tl;dr Can’t figure out how to save image to phone so it’s viewable in gallery.