selective UnknownHostException

Posted by Stephan on Stack Overflow See other posts from Stack Overflow or by Stephan
Published on 2011-01-11T13:09:14Z Indexed on 2011/01/11 18:53 UTC
Read the original article Hit count: 154

Filed under:

Hi everybody!

I am getting said Exception in my program, but only in certain cases. First of all, I have the internet permission set:<uses-permission android:name="android.permission.INTERNET" />, and I tried the two method of this and this thread (they don't work in my case).

The scenario is the following: I send a GET request to a rest service (e.g. http://my.web.site/request.php?attr=blah) and I do get a correct xml back. Now, in this xml there are some resources described, one of which is an url to an image (e.g http://my.web.site/images/img.jpg). Here it's where it fails! Here I consistently receive a UnknownHostException.

I find it weird, since it's the same domain and everything. Accessing the img url from browser works (both from the emulator browser and pc browser). I tried from a device too but it doesn't get the image anyway.

Any idea on why this weird behavior?

EDIT: all my tests were on emulator and device, but connected to a wifi network. I tried also using the internet connection of my provider on the phone (i.e. bypassing home network), and still the behavior is the same...
I found this bug which I assume is the source of this problem, but still no solution (after more than 1.5years). Any ideas?

© Stack Overflow or respective owner

Related posts about android