I am facing weired issue in ionic3 application.
Let me describe my situation in detail: Actually I need offline support for my ionic app. so everytime I call the API, I store the data into local storage. and also download image from the api to my local directory. so that I can fetch data and image when internet is not available from local resources.
I am using this plugin to download image from server to local: https://ionicframework.com/docs/native/file-transfer/
It is working fine if I run following command:
ionic cordova run android
But it is not working when I run following command:
ionic cordova run android --prod
Code :
import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/file-transfer';
import { File } from '@ionic-native/file';
constructor(private transfer: FileTransfer, private file: File) { }
const fileTransfer: FileTransferObject = this.transfer.create();
download() {
const url = 'http://www.example.com/file.pdf';
fileTransfer.download(url, this.file.dataDirectory + 'file.pdf').then((entry) => {
console.log('download complete: ' + entry.toURL());
}, (error) => {
// handle error
});
}
I am not getting any error or issue from console. So I don't know what i am missing. There is also permission for local storage configured well. so permission is not an issue.