Retrofit request works on Wi-Fi, doesn't work on 4Gfrom the CommonsWare Community archives
At May 24, 2019, 11:40am, Raptor asked:
I have an application which executes a post request using Retrofit 2. It’s a multipart with a picture and other data.
On phones with Android 8 or lower, the request works both with Wi-Fi and 4G. On Android 9 phones, though, it only works with Wi-Fi. We are working on a dev endpoint to be fair, but still, even so - it works on all the other phones in both Wi-Fi and 4G.
Do you have any hunch of what might be going on here?
At May 24, 2019, 12:40pm, mmurphy replied:
Sorry, but this board is for supporting my remaining CWAC components. It is not for posting arbitrary Android questions. Please use other resources, such as Stack Overflow (or renew your Warescription, in which case we can move your question over to the Android Development category).
In general, though, you would need to start by identifying more about what “doesn’t work” means. For example, are you failing to connect, or are you connecting and getting an unexpected response.
At May 24, 2019, 1:02pm, Raptor replied:
Ah, sorry, I didn’t even realize that my subscription probably expired, I will renew it when I get home.
But yeah, I get “404 Not Found” response when I make the request over 4G and, from what I saw from the backend logs, the request doesn’t even get to the backend. One friend suggested that maybe Android 9 phones get IPv6 addresses and maybe that is not supported over 4G. Have you ever heard of that (or do you have a better idea)?
Can you please move this question to the Android board? Thanks!
At May 24, 2019, 1:18pm, mmurphy replied:
Well, something is returning a 404. Retrofit will not generate that response code on its own, AFAIK.
You might want to add a logging interceptor or something to your setup to try to determine who Retrofit/OkHttp are talking to in your 4G case.
Then nothing would work. The mobile carrier is responsible for allocating an IP address that works with the mobile carrier.
A slightly more likely scenario is that there is some proxy server that the mobile carrier is adding that is somehow fouling up your communications.
At May 29, 2019, 6:25pm, relaxedsoul replied:
Correct me if I am wrong.
Starting from 9.0 the Mac address of the device is dynamic.
Because of that I had unexpected logouts in my application, when I used 4G network. I suppose that WiFi manage routing in different way, or the connection is more stable, so the device changes the Mac address less times.
We fixed that on server side.
Or it is not connected…