0

OK. Here is some additional details about this problem...

The problem is that when you make a jQuery ajax call in iOS, it seems to take forever to return with a 404. The timeout doesn't seem to take as long on Android.

The reason the timeout is the issue is because the ajax call has a success and fail callback, so it takes the length of the timeout to call the fail callback. If your code doesn't progress until either of these callbacks are called then it will appear as if your app has stalled.

I fixed the immediate problem but I still have this issue in other places where I have a loading spinner - so it's not so much of an issue there. However, is there a way to change this timeout value? And should I change it if I can?


I have a Phonegap app running on Android and IOS.

For some reason the initialization on IOS is very slow when WIFI is turned off. However, it acts normally if Airplane mode is turned on (in which case WIFI is off).

It always behaves the same at initialization on Android.

During initialization the app...

  1. Get's the MACAddress using the phonegap plugin.
  2. Get's the connection information using the phonegap plugin.
  3. Does an ajax call using jQuery ajax, it does not wait for the data to return - however.

I've tried debugging the problem but it seems like the app is doing absolutely nothing while it hangs (it takes like a minute+ to initialize as opposed to the usual couple of seconds). There are no error messages or any significant syslog messages. It eventually starts and works normally.

I'm stuck on ideas as to what could be causing this, I know the code works correctly - at least on Android - because I followed it through and I also removed any unused plugins. I was hoping some of you might have some suggestions as to what you think may be the cause.

I'm sorry that I can't share the source because my boss would be upset with me if I did.

  • I recommend taking a look at this answer: http://stackoverflow.com/questions/23925297/how-fast-typical-phonegap-app-can-be-started-tips-to-speed-up – gotnull May 20 '16 at 00:50
  • Thanks, that was informative but my problem isn't really my load time which is fine except when WIFI is turned off on IOS. The basic default html of the app is shown - not certain if device ready has been called yet or not. – Michael Cornetto May 20 '16 at 01:02
  • are you loading any external script or CDNs at startup ? because that might cause the slow down. – Arpit Vasani May 20 '16 at 04:44
  • No. All resources are local. It downloads some json to update things but only if it's online. But that was something I didn't think to look for so thanks for the comment. – Michael Cornetto May 20 '16 at 05:30
  • take all css and js files in local folder and then run app, as if you are accessing external js or css then surely it will not load if internet is not available so take it all in local folder and then run your app. – Vickyexpert Jun 17 '16 at 04:17

0 Answers0