I have an Android app which, as part of its core functionality, makes ASP.NET WebService calls. I have authored the app successfully using ksoap2 to make the calls and it does what I need it to.
Our client reports that they have found some phones where the app does not work. Namely, during some of the WebService calls it appears to time out. This befuddled me because it works perfectly on the handful of phones we've tested it with here in my office.
One of the phones the client reported having an issue with was the Samsung Galaxy S2 on Sprint (the other phone they reported was either a Samsung Galaxy S or a Samsung Galaxy S3 - real similar phone, in other words). As luck would have it I was able to hunt down an employee in the company who had a Samsung Galaxy S2 on Sprint and was willing to let me borrow it. And I was able to re-create the issue. Attached to Eclipse it appears to be getting a SocketTimeoutException. Not every time, but more often than not.
As part of my testing, I connected the phone to a MiFi on Verizon. So, essentially I was taking it off of Sprint's network and putting it on Verizon's. When I did this, the app worked as expected, no timeouts.
At first I thought maybe Sprint's network was just bad but that seemed unlikely seeing as how my client is on the other side of the country from me so unless their network is consistently bad I doubt that's the case.
But what I noticed is - in the status bar of the phone, when connected to Sprint, I saw 3G and 4G icons, and they appeared to be switching back and forth (the way they're laid out, they both appear, just turned off/on right next to each other). When I was connected to the MiFi, as far as the phone knows or cares I'm connected to a Wi-Fi point.
So what I wonder is - could it be that the phone is "switching" back and forth between the 3G and 4G networks and the response to the webservice call is getting lost? On the iPhone if you make a request for a webpage in Safari with your phone on the 3G network (for example) and the phone then finds a Wi-Fi point to connect to and switches over, you still get the webpage on your device even after it connects to Wi-Fi. I presume that the OS is allowing the 3G calls to finish out before switching that network off.
Could something that Samsung has done with the OS for the Galaxy S* line be causing my responses to be getting lost? And if so, is there something I can do about it to prevent this from happening? Is there a way to figure out what network connections are still alive?
UPDATE: See my answer below, this question's premise turned out not to be the reason, although it does occur to me that I forgot to point out that the particular calls that fail or timeout contain base64-encoded images and so they're larger than normal webservice calls.
For what it's worth, the answer appears to be "no"
I used the code from this blog entry which allows me to monitor when a network connection change occurs and I was able to verify that the behavior occurs even when the network connection doesn't change.
So it does appear that for whatever reason this particular combination (Sprint/Samsung Galaxy S or S2) doesn't like what I'm doing.
One thing I forgot to mention is that I'm sending a Base64-encoded image across the web service call so the size may have some relation to it but I can't figure out what the issue is exactly.