I have get UnknownhostException in parsing JSON data from server,
My URL working on :
on real device browser(data plan only)
Sometimes its working on PC browser and sometimes not.
Actually I have get the wifi issue, Sometimes its working on wifi connection, when its not, I have restarted my wifi and its worked, and after some time the same issue came,
I want to get the permanent solution for this wifi connection issue, Restarting the Wifi is never a solution on the application user side,
What is the exact problem and solution also...
Usually the
UnknownHostException
fires when you cannot resolve the DNS record of the URL you've provided. There's a reasonable timeout for that operation, but if you have a weak WiFi connection or you don't have enough signal on your device, the communication can be interrupted in the middle between sending and receiving the response, so your device doesn't receive the response, thus it thinks it's a DNS timeout.There are 2 things you can try:
Increase the timeout of the response. This will not help, though, if your communication gets interrupted you already sent the query.
Use the IP address instead:
It will give u wifi speed so just mention one speed if that speed come then only do next work