I have an HTTP get Service url and i can connect and get resource from this url on almost all version of sdk but in 4.1.2 it gives UnknownHostException. Internet permission is already there and also internet connection is active. Please help.
Here is code:
try {
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet("myhosturl");
HttpResponse responseGet = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
if (resEntityGet != null)
{
String response = EntityUtils.toString(resEntityGet);
}
}
catch (Exception e)
{
e.printStackTrace();
}
Actually this url is called when there is any incoming call that time it gives exception. If i hit this url any other time it works.