kolbasa/cordova-plugin-apkupdater

Download manifest fails all the time until I make xmlhttprequest for it

rbaumi opened this issue · 5 comments

To simple show the problem:

I have a button X that after click calls cordova.plugins.apkupdater.check('[MY_MANIFEST_URL]');
I have another button Y that after click makes a xmlhttprequest in angular this.http.get('[MY_MANIFEST_URL]').subscribe();

Manifest file is accessible under [MY_MANIFEST_URL]

Each time I press button X I get an error Download failed, but if I press button Y at least one time then pressing button X every time gives me success response with object I expect.

Network status is OK. On the server side I log the requests and before I make my own I get nothing from apkupdater. After I make my own then apkupdater.check() works fine. After app is restarted problem is back.

Any clue what is going on?

The error handling is unfortunately not too good, I still have to work on it :)

Can you please configure the observer before the check() call as follows:

cordova.plugins.apkupdater.setObserver(
    {
        downloadProgress: console.log,
        exception: console.error
    }
);

cordova.plugins.apkupdater.check('[MY_MANIFEST_URL]');

This should give you the complete error message.
This is how it looks on my end:
error_handling

Thanks. This is what I get in the console:

image

SSL Certificate for the server is fine. And again - when I request this manifest file from any place in my app (as ajax request) then apkupdater.check() works fine.

One thing I have noticed is that I serve manifest file from the server through https on non standard port (3001, not 443) - can this be related to this?

Ok, I'm also struggling with downloading the update chunks. When I serve the files and manifest through standard 443 port everything works fine. So for now I'm gonna do that, but it would be nice to have an option to change it.

https on a non standard port? That's possible? :D

Of course. Currently I'm using NestJS framework that under the hood uses express that serves content on given port using https protocol. Works like a charm. More in the docs: https://docs.nestjs.com/faq/multiple-servers