Hello, I got this issue sometimes, not always and I can’t figure why yet.
We use FileTransfer, Zip and File from Ionic native.
My code looks like this:
const fileTransfer: FileTransferObject = self.transfer.create();
fileTransfer.download(url, file.dataDirectory + FILE_NAME)
.then(() => {
self.zip.unzip(file.dataDirectory + FILE_NAME, file.dataDirectory)
.then((result) => {
if (result == 0) {
// Always get here but sometimes, readAsText never resolves...
file.readAsText(this.file.dataDirectory, NOM_FICHIER_XML)
.then((data) => {
})
.catch((Error) => {
})
}
}
}
ionic info:
cli packages:
@ionic/cli-utils : 1.13.0
ionic (Ionic CLI) : 3.13.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 3.0.0
Cordova Platforms : android 6.3.0
Ionic Framework : ionic-angular 3.7.1
System:
Android SDK Tools : 26.0.1
Node : v6.9.5
npm : 4.2.0
OS : Windows 7
Config.xml:
<plugin name="cordova-plugin-file" spec="4.3.3" />
<plugin name="cordova-plugin-zip" spec="3.1.0" />
<plugin name="cordova-plugin-file-transfer" spec="1.6.3" />
Package.json:
"@ionic-native/file": "4.3.1",
"@ionic-native/file-transfer": "4.3.1",
"@ionic-native/zip": "4.3.1",
The workaround about placing cordova.js after polyfills.js works for us, but it kind of break the splash screen (where the splash screen is rapidly replaced with a gray background at startup).
Any idea why the File.readAsText() doesn’t resolve sometimes ?
Thanks.