3

I'm building an ionic app, with ionic 3 and angular 5.2. Everything has been working well for the longest time I can remember, until recently I noticed weird behavior.

Dev-tools network tab showing the request status

As from the image, the request stays in pending status forever.

The backend is done in PHP, and it's working fine in a different app as well as website without issues. The log for the above requests is as shown below.

Yii2 request and response status

I've checked this questions among other solutions, but none seems to resolve my issue.

I'm using ionic-cli 4.3.1 (tried with earlier versions too).

Edit

I never found a solution to this, and since I was working on a short timeline, the only quickest option I had was to migrate to Ionic V4. The issue has since gone away, and the app is running fine.

Murwa
  • 2,238
  • 1
  • 20
  • 21

2 Answers2

2

I had a similar problem. After some time, the requests were placed in a "pending" state. I solved this thanks to the Cordova Background Plugin by doing:

cordova.plugins.backgroundMode.setDefaults({ silent: true });
cordova.plugins.backgroundMode.on('activate', function() {
    cordova.plugins.backgroundMode.disableWebViewOptimizations(); 
});
cordova.plugins.backgroundMode.enable();
  • Thank you @Damian. It worked for me. I am having same problem where application goes in background after some refresh interval time API requests all shown as Pending where I applied above solution and it worked for me. Thank you – Swift May 14 '19 at 08:27
0

In my case, the requests would go from pending to cancelled. Turns out the SSL cert chain on our server was misconfigured. Adding the certs of the certifying organizations to our bundle solved the SSL problem, which made Android allow sending the requests.

Use https://www.sslshopper.com/ssl-checker.html to see if your chain is ok. The lock icon on the browser was showing "site secure", I guess Android is a little pickier.

TomEberhard
  • 907
  • 10
  • 11