Unknownhostexception In Android : Wifi Issue
I have get UnknownhostException in parsing JSON data from server, My URL working on : http://jsonlint.com on real device browser(data plan only) Sometimes its working on PC browse
Solution 1:
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:
Solution 2:
WifiManager wifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
int linkSpeed = wifiManager.getConnectionInfo().getRssi();
System.out.println("Link Speed is======"+linkSpeed);
It will give u wifi speed so just mention one speed if that speed come then only do next work
Post a Comment for "Unknownhostexception In Android : Wifi Issue"