Hey Everyone,
I have a strange error that I hope someone can help me with.
I have developed some functionality using the Native File plugin that is used to read and write files to the device storage. This has been working fine during development when running my app with the command:
ionic cordova run android -l
But when I choose to use:
ionic cordova run android
The file read and write functionality doesn’t work?!?
Here is an example of the code that is no longer working:
saveImageToDevice(projectKey: string, imageData: Blob | string, imageName: string): Promise<any> {
return new Promise((resolve, reject) => {
let options: IWriteOptions = {
replace: true
}
this.file.writeFile(this.file.externalDataDirectory + projectKey, imageName, imageData, options).then(fileWriteRes => {
resolve(fileWriteRes)
}).catch(err => {
console.log("There was an error writing the file")
console.error(err)
})
})
})
}
Everything works as expected when I run the app with the live reload option, but when I without the live reload option… the promise just hangs and never resolves or rejects.
What could be causing this??