I'm using cordova file plugin - cordova file plugin
I'm actually reading the file from the textfile. Below is my code
document.addEventListener("deviceready", function () {
window.resolveLocalFileSystemURL(cordova.file.applicationDirectory + "sameple.txt", gotFile, fail);
}, true);
function gotFile(file) {
file.file(function (file) {
var reader = new FileReader();
reader.onloadend = function (evt) {
console.log(this.result);
}
reader.readAsText(file);
}, fail());
}
function fail(e) {
console.info("FileSystem Error : " + e);
}
So whenever i run this code, i'm getting the below error
deviceready has not fired after 5 seconds.
Channel not fired: onPluginsReady
Channel not fired: onCordovaReady
Could not get Cordova FileSystem: Error: deviceready has not fired after 5 seconds.
"Could not get Cordova FileSystem:"
{
[functions]: ,
__proto__: { },
description: "deviceready has not fired after 5 seconds.",
message: "deviceready has not fired after 5 seconds.",
name: "Error"
}
{"data":"data"}
After deviceready error
later i'm able to get the exact data.. How do i resolve this error? do i have to wait for the device ready execution to complete?
It can happen for a number of reasons, see here more details.
You should try firs @bayanAbuawad suggestion that works most of the times:
Add the platforms with cordova platform add ios android
Remove them with cordova platform remove ios android
Add them again.
It is super weird, but it’s related to a faulty android.json and ios.json inside the platforms folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With