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

  • SEARCH
  • Home
  • 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 5987825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:52:16+00:00 2026-05-22T22:52:16+00:00

I have the following code to download a file in the notification system. But

  • 0

I have the following code to download a file in the notification system. But it doesn’t seem to working… I’m not sure why, everything looks good to me. The debugger is giving me an unknown host error?

06-02 00:21:15.308: WARN/System.err(4115): java.net.UnknownHostException: phobos.emuparadise.org
06-02 00:21:15.308: WARN/System.err(4115):     at java.net.InetAddress.lookupHostByName(InetAddress.java:506)
06-02 00:21:15.308: WARN/System.err(4115):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
06-02 00:21:15.308: WARN/System.err(4115):     at java.net.InetAddress.getAllByName(InetAddress.java:256)
06-02 00:21:15.308: WARN/System.err(4115):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:69)
06-02 00:21:15.308: WARN/System.err(4115):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:48)
06-02 00:21:15.308: WARN/System.err(4115):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection$Address.connect(HttpConnection.java:322)
06-02 00:21:15.308: WARN/System.err(4115):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:89)
06-02 00:21:15.308: WARN/System.err(4115):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHttpConnection(HttpURLConnectionImpl.java:285)
06-02 00:21:15.308: WARN/System.err(4115):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.makeConnection(HttpURLConnectionImpl.java:267)
06-02 00:21:15.312: WARN/System.err(4115):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:205)
06-02 00:21:15.312: WARN/System.err(4115):     at co.ezeh.android.romget.ui.ListActivity$RomDownloadTask.doInBackground(ListActivity.java:139)
06-02 00:21:15.312: WARN/System.err(4115):     at co.ezeh.android.romget.ui.ListActivity$RomDownloadTask.doInBackground(ListActivity.java:1)
06-02 00:21:15.312: WARN/System.err(4115):     at android.os.AsyncTask$2.call(AsyncTask.java:185)
06-02 00:21:15.316: WARN/System.err(4115):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
06-02 00:21:15.316: WARN/System.err(4115):     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
06-02 00:21:15.316: WARN/System.err(4115):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
06-02 00:21:15.316: WARN/System.err(4115):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
06-02 00:21:15.320: WARN/System.err(4115):     at java.lang.Thread.run(Thread.java:1019)

And this is the class i am trying to use, i can’t see any errors with it though…

private class RomDownloadTask extends AsyncTask<RomDataSet, Integer, String> {

    private PendingIntent pendingIntent;
    private Notification notification;
    private NotificationManager notificationManager;

    @Override
    protected String doInBackground(RomDataSet... params) {
        try {
            //set the download URL, a url that points to a file on the internet
            //this is the file to be downloaded
            URL url = new URL(params[0].url);

            //create the new connection
            HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();

            //set up some things on the connection
            urlConnection.setRequestMethod("GET");
            urlConnection.setDoOutput(true);

            //and connect!
            urlConnection.connect();

            //set the path where we want to save the file
            //in this case, going to save it on the root directory of the
            //sd card.
            File SDCardRoot = Environment.getExternalStorageDirectory();
            //create a new file, specifying the path, and the filename
            //which we want to save the file as.
            File file = new File(SDCardRoot,"somefile5.zip");

            //this will be used to write the downloaded data into the file we created
            FileOutputStream fileOutput = new FileOutputStream(file);

            //this will be used in reading the data from the internet
            InputStream inputStream = urlConnection.getInputStream();

            Integer downloadedSize = 0;

            Integer totalSize = urlConnection.getContentLength();

            //create a buffer...
            byte[] buffer = new byte[1024];
            int bufferLength = 0; //used to store a temporary size of the buffer

            //now, read through the input buffer and write the contents to the file
            while ( (bufferLength = inputStream.read(buffer)) > 0 ) {
                //add the data in the buffer to the file in the file output stream (the file on the sd card
                fileOutput.write(buffer, 0, bufferLength);
                //add up the size so we know how much is downloaded
                downloadedSize += bufferLength;
                //this is where you would do something to report the prgress, like this maybe

                publishProgress((downloadedSize / totalSize) * 100);
            }
            //close the output stream when done
            fileOutput.close();

        //catch some possible errors...
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected void onPreExecute() {
        Intent intent = new Intent(ListActivity.this, ListActivity.class);
        pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);

        // configure the notification
        notification = new Notification(R.drawable.ic_stat_rom, "Downloading Rom via RomGet", System
                .currentTimeMillis());
        notification.flags = notification.flags | Notification.FLAG_ONGOING_EVENT;
        notification.contentView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.layout_download);
        notification.contentIntent = pendingIntent;
        notification.contentView.setImageViewResource(R.id.status_icon, R.drawable.icon_rom);
        notification.contentView.setTextViewText(R.id.download_description, "Downloading");
        notification.contentView.setProgressBar(R.id.download_progress, 100, 0, false);

        getApplicationContext();
        notificationManager = (NotificationManager) getApplicationContext().getSystemService(
                Context.NOTIFICATION_SERVICE);

        notificationManager.notify(43, notification);
    }

    @Override
    protected void onProgressUpdate(Integer... progress) {
        notification.contentView.setProgressBar(R.id.download_progress, 100, Math.round(progress[0]), false);
        //notification.contentView.setTextViewText(R.id.download_description, Integer.toString(downloadedSize));
        // inform the progress bar of updates in progress
        notificationManager.notify(43, notification);
    }

    @Override
    protected void onPostExecute(String result) {
           notification.contentView.setTextViewText(R.id.download_description, "Done");
           notificationManager.notify(43, notification);
    }

}

Cheers

  • 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-22T22:52:17+00:00Added an answer on May 22, 2026 at 10:52 pm

    The URL it is trying to connect (phobos.emuparadise.org) shows a 403 Forbidden (try with a browser). If you solve this, you should be good.

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

Sidebar

Related Questions

I have the following code for managing file download through django. def serve_file(request, id):
i have written the following code to download file. java.io.BufferedInputStream in = new java.io.BufferedInputStream(new
I have following js code: clientData.reloadTable( CreateCSV, /create/file ); $(#downloadFrame).attr(src,/download/download); In above code. first
I have written the following scala code to download a file . The file
I have the following code that will download a file asynchronously to my hard-drive,
I have the following X.aspx code..to download excel file from Server if (ss[5] !=
i have used a code to download file it works well in IE7,, but
I have the following code to download a URL through a proxy: proxy_handler =
I’m using the following code to download a file from a remote ftp server:
I have the following code to retrieve a file using FTP (which works fine).

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.