Using HTTPClient with setInterval and handling pause resume events
I'm using setInterval() to make an XML HTTP Request with Titanium.Network.HTTPClient every 60 seconds. This works fine, but when the handset (iPhone) goes idle after 30 seconds or so of inactivity and locks, when I unlock it and return to the app, the XHR isn't working correctly. It appears to get stuck in a request and never completes (returns).
I tried adding event listeners on the pause and resume events to clearInterval() on pause and setInterval() on resume but this doesn't seem to be working either.
Has anyone else experienced this issue? If so, have you found a solution?
1 Answer
-
my suggestion is that you ensure you shut down any active request when the device locks up, and then make sure you clean up and restart your requests appropriately when the device becomes active again.
I apologize if you are already doing these things, but since there is no code posted, I am making some assumptions.