I have an Android code that uses a background process to regularly (e.g. hourly) connect to a content source on the Internet to check for updated content. Since new users download the application and launch it for the first time, it seems (and it just “seems like at the moment”) that in this first situation, since the DNS for our servers is not already cached on the device, this first series of connections fails with UnknownHostException : host not resolved. And, of course, the application again tries again and (again, “looks like”), it all works - perhaps because the OS managed to actually resolve the address.
So my questions are: (1) Do other Android developers also see this behavior with their deployed applications? For the first time, a series of "host unresolved" problems that work later. (2) Does anyone have a better strategy for "warming up the DNS" so that the first real connections work? or maybe you just tried some kind of rollback when you come across this exception? I considered a separate stream that tries to extract a small text file from our server, and it just loops until it receives it, and (possibly not sure about this part) blocks other outgoing network connections until it succeeds .
Anyway, I read a piece of answers to various similar questions here in Stack Overflow, and I just assured everyone that
<uses-permission android:name="android.permission.INTERNET" />
installed in my manifest file :)
java android
sorens Jul 20 '10 at 19:34 2010-07-20 19:34
source share