title: java.io.FileNotFoundException: /storage/emulated/FileTest1.zip: open failed: EACCES (Permission denied)
body: <p>I'm having a problem when I try to download zip file from server. I'm using intentservice to download the file but I'm getting this exception</p>
  
  <pre><code>java.io.FileNotFoundException: /storage/emulated/FileTest1.zip: open failed: EACCES (Permission denied)
  </code></pre>
  
  <p>I try to save files on internal storage, NOT on sdcard.
  Here is my code</p>
  
  <pre><code>@Override
  protected void onHandleIntent(Intent intent) {
      String urlDir = intent.getExtras().getString(DOWNLOAD_SERVICE_URL);
      String fileName = intent.getExtras().getString(DOWNLOAD_SERVICE_FILE_NAME);
      String filePath = intent.getExtras().getString(DOWNLOAD_SERVICE_FILE_PATH);
  
      try{
          URL url = new URL(urlDir);
          URLConnection connection = url.openConnection();
          connection.connect();
  
          BufferedInputStream input = new BufferedInputStream(url.openStream());
          String tempName = filePath + fileName;
          FileOutputStream output = new FileOutputStream(tempName);
  
          byte data[] = new byte[1024];
  
          while (input.read(data) != -1) {
              output.write(data);
          }
  
          output.flush();
          output.close();
          input.close();
  
      } catch(Exception e){
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>How canI fix it?</p>