views:

55

answers:

2

I try to retrieve a picture from e.g

http://graph.facebook.com/btaylor/picture

using the following code:

DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet request = new HttpGet(urlString);
HttpResponse response = httpClient.execute(request);
return response.getEntity().getContent();

but occasionally I get the exception

java.net.UnknownHostException: profile.ak.fbcdn.net

Why is this?

Edit: by "occasionally", I mean that it happens often enough that I know the reason is not "My internet is down" or "Facebook is down."

A: 

Using an emulator, there are some known network limitations, However on device it works fine. So, are you using an emulator?

AJPRA23
I'm running the program through my Nexus One (i.e USB connection)
Gilbert
A: 

If your device is connected on WiFi, could be due to this issue where the WiFi enters sleep mode.

http://www.boygeniusreport.com/2010/07/14/some-nexus-one-users-experiencing-wi-fi-connectivity-issues/

In my case, I see in the log:

D/WifiService( 1087): setting ACTION_DEVICE_IDLE timer for 900000ms

Then 15 minutes later, the WiFi is turned off.

Alan