Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 937583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:30:09+00:00 2026-05-15T21:30:09+00:00

I have android code that uses a background process to routinely (e.g. hourly) connect

  • 0

I have android code that uses a background process to routinely (e.g. hourly) connect to a content source on the web to check for updated content. As new users download the app and run it for the first time, it seems (and this is just a “seems at the moment) that in this first-run situation, because the DNS for our servers are not cached already on the device, those first series of connections fail with dreaded UnknownHostException: Host is unresolved. And of course, the application tries again later and (again, “it seems like”) it is all working — perhaps because the OS has had time to actually resolve the address.

So, my question(s) are: (1) Do other Android developers see this behavior with their deployed applications as well? First time, a series of “host unresolved” issues that work themselves out later. (2) Does anyone have a better strategy for “warming up the DNS” so-to-speak so that the first real connections work? or perhaps do you just re-try with some back-off looping when you encounter this exception? I was contemplating having a separate thread that tries to fetch a small text file from our server and have it just loop until it gets it and maybe (not sure about this part) block the other outgoing network connections until it succeeds.

In any event, I have read through a chunk of the answers to various similarly worded questions here on Stack Overflow and I just to assure everyone that

<uses-permission android:name="android.permission.INTERNET" />

is set in my Manifest file 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:30:10+00:00Added an answer on May 15, 2026 at 9:30 pm

    I have come across this behaviour while using HttpUrlConnection. I am using simple workaround – I execute the following code just before using any url.

        try {
          InetAddress i = InetAddress.getByName(URLName);
        } catch (UnknownHostException e1) {
          e1.printStackTrace();
        }
    // ... actually using URLName
    

    For the first time I obtain here UnknownHostException but next usages of the url are successful (DNS server returns proper IP address and I can connect to the server).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 496k
  • Answers 496k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you are specifically after a Javadoc quality tool, then… May 16, 2026 at 11:40 am
  • Editorial Team
    Editorial Team added an answer You can also use model inheritance class Territory(models.Model): name =… May 16, 2026 at 11:40 am
  • Editorial Team
    Editorial Team added an answer The problem is probably in one of these: Content-Type: text/xml;… May 16, 2026 at 11:40 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have an Android project that contains a class that uses JNI to pull
Possible Duplicate: How to open-source an application that uses API keys I have an
I have an android app that listens for json commands over a socket. I
Sipdroid on Android has a search & replace method, that uses regex. I'm trying
I'm trying to create an application for Android that uses encryption to save user
I have an app that needs to scan a barcode to get a code
I changed some code on an android application that was working perfectly fine at
I have an MP3 audio file that I want to play from my Android
I have a custom class that I've written that extends ImageView (for Android Java).
I am developing an application which uses Bluetooth to connect to a device and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.