I've an application with Capacitor 3, Ionic 5 and Angular. I'm using Capacitor Http plugin for all requests due to CORS problem in the server.
The application makes http requests against the server, but sometimes, when the quality of network is bad, the request hangs the device or fails and exit the app.
I can't implement a retry strategy, for example with Observables in angular, because I'm using the Capacitor Http plugin and not Angular HttpClient.
With Capacitor I can detect if the device is online (network connectivity) or it's offline, but not a poor connection.
Does anyone have experience with this situation and how to resolve it?
Regards J
I think you can try few things maybe its can help you for solve the problem.
Test connection on every page change.(You can write a global service for control the network connection. Every page opening you control
the connection with ionViewWillEnter() so if the connection bad show
the alert.
Convert Capacitor HttpClient to Angular HttpClient
Maybe you can try setTimeout function. Call the function before the http request and then control the response. If you don't have any response fail the request and show alert.
I hope these help you.