Here is the situation. My app runs fine, and is able to establish connections with URLs. BUT after a few hours of leaving the app running, all of a sudden the Facebook reque
I don't have any core conceptual knowledge about network connectivity and DNS caching and TTL management.
but the same problem occurred to me and at that time Just As a Workaround I have made few changes in the Facebook project's Util.java [The source project of the Facebook SDK] and then used it for my project. That two changes is just used from different stackoverflow answers.
In the function openUrl(String url, String method, Bundle params)
Replace this line,
HttpURLConnection conn =
(HttpURLConnection) new URL(url).openConnection();
with these lines,
try {
InetAddress i = InetAddress.getByName(url);
} catch (UnknownHostException e1) {
e1.printStackTrace();
}
HttpURLConnection conn = (HttpURLConnection) new URL(url)
.openConnection();
conn.setConnectTimeout(50000);
And my problem was reduced.