Heyo,
I am using the following code to download a file. This works on iOS without any issue.
On Android at least in the emulator on the localhost. However, after deploying to the server and running the app either in an emulator pointing to this, or a real device, an error message appears. Only on Android.
Do you have any idea how I can solve this? Thank you!
if (isPlatform('android')) {
try {
setTimeout(() => {
File.removeFile(File.externalDataDirectory, filename)
}, 2000)
} catch (e) {
console.log(e)
}
File.writeFile(File.externalDataDirectory, filename, content, true).then(success => {
FileOpener.showOpenWithDialog(File.externalDataDirectory + filename, mimeType)
.then(() => console.log('File opened'))
.catch(e => toast.error("Fehler beim Öffnen der Datei: " + e));
})
.catch(e => toast.error("Fehler beim Speichern der Datei: " + e));
}
Uncaught TypeError: Cannot read property 'then' of undefined