title: Permission Denied but permission is set in manifest
body: <p>I receive this error:</p>
  
  <blockquote>
    <p>remove failed: ENOENT (No such file or directory) : /storage/emulated/0/screenShot.jpg<br>
    FileNotFoundException: /storage/emulated/0/screenShot.jpg: open failed: EACCES (Permission denied)</p>
  </blockquote>
  
  <p>while running this screenshot method (the error points at the FileOutputStream creation from the imageFile, after "else"):</p>
  
  <pre><code>public void shareScreenshot(View v){
      Date now = new Date();
      android.text.format.DateFormat.format("yyyy-MM-dd_hh-mm-ss", now);
  
      CharSequence nowStr = DateFormat.format("yyyy-MM-dd_hh-mm-ss", now);
  
      try {
          // image naming and path  to include sd card  appending name you choose for file
          String mPath = Environment.getExternalStorageDirectory().toString() + "/" + "screenShot" + ".jpg";
  
          // create bitmap screen capture
          View v1 = getWindow().getDecorView().getRootView();
          v1.setDrawingCacheEnabled(true);
          Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache());
          v1.setDrawingCacheEnabled(false);
  
          File imageFile = new File(mPath);
          if(imageFile.delete()){
  
              FileOutputStream outputStream = new FileOutputStream(imageFile);
              int quality = 100;
              bitmap.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);
              outputStream.flush();
              outputStream.close();
  
              startShareIntent(imageFile);
  
          }else{
  
              FileOutputStream outputStream = new FileOutputStream(imageFile);
              int quality = 100;
              bitmap.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);
              outputStream.flush();
              outputStream.close();
  
              startShareIntent(imageFile);
          }
  
  
      } catch (Throwable e) {
          // Several error may come out with file handling or OOM
          e.printStackTrace();
          Toast.makeText(this,"Something went wrong, try again.", Toast.LENGTH_SHORT).show();
  
      }
  }
  </code></pre>
  
  <p>And here's my manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-permission android:name="android.permission.GET_ACCOUNTS" /&gt;
  &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
  &lt;uses-permission android:name="com.android.vending.BILLING" /&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:theme="@style/Theme.AppCompat.Light.NoActionBar" &gt;
      &lt;activity
          android:name=".MainActivity"
          android:label="@string/app_name" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>