Hi there,
I’m having an issue using the command:
ionic run android
whereby local files are loading very slowly.
I have a provider in my application which does the following:
`loadFile (url) {
this.startTime = new Date().getTime();
let blob = null;
let xhr = new XMLHttpRequest();
xhr.open("GET", url);
xhr.responseType = "blob";
xhr.onload = () => {
this.receiveTime = new Date().getTime();
console.log('got the file, it took: ', (this.receiveTime - this.startTime) / 1000, ' seconds')
blob = xhr.response;
let bFile = new File([blob], blob);
this.LoadAndDisplayFile(bFile);
}
xhr.send();
}`
the loadAndDisplayFile()
function provides a callback which looks like this:
fileLoadCallback() {
let now = new Date().getTime()
console.log('file now displayed it took: ', (now - this.receiveTime) / 1000, 'seconds to complete')
this.completedLoading(true)
}
The console outputs I get when running ionic serve
look like this:
got the file, it took: 0.47 seconds
file now displayed it took: 7.733 seconds to complete
But when I run this on android using ‘ionic run android’ (and using the chrome dev tools to debug), I get the following:
got the file, it took: 48.294 seconds
file now displayed it took: 30.813 seconds to complete
The load and display file is taking a file and displaying it on a webgl 3d canvas, so I might expect the second part to take a bit longer
But how can I go about reducing the 40 something seconds extra it takes to load files when debugging on my android device??