I am working on Angular 17/ capacitor 6/ Ionic 7 application. The app is not responding immediately after couple of hours, if we don’t touch the app. It will take 30 to 60 seconds to respond back. As I understood, the app is going to freezing mode and taking time to become active when we touch the app. Any suggestions to address this issue.
Are we talking on Android and iOS or just one of them? This doesn’t seem normal. Is your app doing a lot of work on launch?
it’s on Android. iOS is working fine.
On any tab/page, it will get data from API and populate the data.
I’ve seen my app relaunch (the WebView refreshes, not a full relaunch) when it’s been in the background a while and you come back to it. Is it possible this is happening and your API calls are holding it up?
Based on further testing the issue observed on Android 14. On Android 13, it’s take few seconds, but on Android 14 it’s taking 30 to 60 seconds. Any suggestions in the aspect of Android 14?
Also, for Android 14, we observed issue with initial login taking more than 2 minutes most of the times.
Please share some code in how you are making these API calls. Are you using CapacitorHttp
directly or indirectly by having it intercept fetch
or XMLHttpRequest
calls?
We are using HttpClient from Angular for API calls. Once I tried to use CapacitorHttp, but it’s not supporting image file data.
Interesting then that you are having issues with Angular’s client. My opinion is to only reach for CapacitorHttp
if absolutely necessary as it has its own overhead. So good, you aren’t using it.
Have you inspected the request in DevTools to see if that gives you any insight? You can open up DevTools by going to chrome://inspect/#devices in Chrome while running the app via Android Studio on your phone or emulator.
I have checked the API calls using dev tools
- After keeping the app for idle state (approximately 2 hours or next day morning), I observed the Api call show in the network tab. But not action happens for 30 -60 seconds. But the same API calls will respond in ms after that.
- During initial login process, I observed the api calls to identity (WSO2) server and callback service, they will get respond upto 2.2 minutes each. After that, it will take < 2 sec for both the call. I thought some problem could be with Identity server or Callback service. But when I watched logs on those services, it’s taking time to reach the call to reach the server (i.e.2.2 minutes). Once the services the call, they are responding in less than 1 sec. Based on research, I understood it could be a problem with Android 14 devices with IPV6 and added Okhttp dependencies as mentioned in below link for react native application. But that didn’t solve the problem for me.
react native - Android 14 first fetch painfully slow - Stack Overflow
So I got blocked with both the issues for last few days.