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 7930109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:18:49+00:00 2026-06-03T20:18:49+00:00

here’s my problem: I tried like 10 different solutions now, and it still won’t

  • 0

here’s my problem:
I tried like 10 different solutions now, and it still won’t work.

I want to download a PDF File from the internet and then save it to external storage.

What I’ve done:
– Added INTERNET and WRITE_EXTERNAL_STORAGE “Uses Permissions”
– Tried with Emulator, as well as Galaxy Nexus plugged in and plugged off

That’s my doInBackground download method:

26    @Override
27    protected String doInBackground(String... downloadUrl) {
28      if (!mediaIsAvailable()) return null;
29
30      final int BUFFER_SIZE = 1024 * 23;
31      String url              = downloadUrl[0];
32      String target_filename  = downloadUrl[1];
33      String ns = Context.NOTIFICATION_SERVICE;
34      NotificationManager notificationManager = (NotificationManager) context.getSystemService(ns);
35
36      try {
37          File targetDir = new File(Environment.getExternalStorageDirectory(), "Download");
38          if(!targetDir.exists())
39          {
40              targetDir.mkdirs();
41          }
42
43          File file = new File(targetDir, target_filename);
44          URL urlObj = new URL(url);
45          URLConnection connection = urlObj.openConnection();
46
47          BufferedInputStream bis = new BufferedInputStream(connection.getInputStream(), BUFFER_SIZE);
48
49          FileOutputStream fos = new FileOutputStream(file);
50          byte[] bArray = new byte[BUFFER_SIZE];
51          int current = 0;
52          int read = 0;
53          while(current != -1)
54          {
55              fos.write(bArray,0,current);
56              current = bis.read(bArray, 0, BUFFER_SIZE);
57              read = read + current;
58          }
59          fos.close();
60          bis.close();
61          notificationManager.cancel(1);
62      } catch (MalformedURLException e) {
63          e.printStackTrace();
64      } catch (FileNotFoundException e) {
65          e.printStackTrace();
66      } catch (IOException e) {
67          e.printStackTrace();
68      }
69      return null;
70    }

and that’s the Exception I get:

05-10 08:31:17.861: W/System.err(23054): java.io.FileNotFoundException: /mnt/sdcard/Download/speiseplan-rosenheim.pdf: open failed: EACCES (Permission denied)
05-10 08:31:17.861: W/System.err(23054):    at libcore.io.IoBridge.open(IoBridge.java:406)
05-10 08:31:17.861: W/System.err(23054):    at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
05-10 08:31:17.861: W/System.err(23054):    at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
05-10 08:31:17.861: W/System.err(23054):    at de.fhrosenheim.app.campus.helpers.DownloadFileHelper.doInBackground(DownloadFileHelper.java:49)
05-10 08:31:17.861: W/System.err(23054):    at de.fhrosenheim.app.campus.helpers.DownloadFileHelper.doInBackground(DownloadFileHelper.java:1)
05-10 08:31:17.861: W/System.err(23054):    at android.os.AsyncTask$2.call(AsyncTask.java:264)
05-10 08:31:17.861: W/System.err(23054):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
05-10 08:31:17.861: W/System.err(23054):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
05-10 08:31:17.861: W/System.err(23054):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
05-10 08:31:17.861: W/System.err(23054):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
05-10 08:31:17.868: W/System.err(23054):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
05-10 08:31:17.868: W/System.err(23054):    at java.lang.Thread.run(Thread.java:856)
05-10 08:31:17.868: W/System.err(23054): Caused by: libcore.io.ErrnoException: open failed: EACCES (Permission denied)
05-10 08:31:17.868: W/System.err(23054):    at libcore.io.Posix.open(Native Method)
05-10 08:31:17.868: W/System.err(23054):    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
05-10 08:31:17.868: W/System.err(23054):    at libcore.io.IoBridge.open(IoBridge.java:390)
05-10 08:31:17.868: W/System.err(23054):    ... 11 more

Thanks in advance 🙂

  • 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-06-03T20:18:51+00:00Added an answer on June 3, 2026 at 8:18 pm

    Is there a chance, that there was “WRITE_INTERNAL_STORAGE” as a permission instead of the “WRITE_EXTERNAL_STORAGE” i added VIA THE PERMISSIONS GUI? I don’t know why that happened, but I fixed the xml and it now works. Thank you guys anyways

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

Sidebar

Related Questions

Here is my work environment: Eclipse Juno as IDE with maven2 plugin on it
I have just tried to save a simple *.rtf file with some websites and
Here's my problem I have this javascript if (exchRate != ) { function roundthecon()
Here's my search array: $aExt = array('png','jpg','gif'); I want to search through the variable:
Here is what I want to do. Use this HTML line and have the
Here's the link: www.mchenry.edu/maps/google.asp Why won't the location balloon display correctly? Also, the pop-up
Here's my situation. I have a DotNetNuke application. I want to link to an
Here's my .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .*
Here is my problem: I have a chatapplication and the messages are displayed in
Here is the code in which i am having the problem- <!DOCTYPE html> <html>

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.