title: Android 10 permission denied
body: <p>When I try to send an image to the server I get an error. On a device with Android 6 and Android 9, everything works well. But when I use a device with Android 10 or BlueStacks 4 emulator I get an error. My Manifesto looks like this: </p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  </code></pre>
  
  <p>I also tried adding the following tag to the manifest: <code>android:requestLegacyExternalStorage="true"</code>
  but my problem remains. In the logs I get an error that the <code>Compressor</code> library gets null</p>
  
  <p>My Activity:</p>
  
  <pre><code>override fun onRequestPermissionsResult(requestCode: Int, permissions: Array&lt;out String&gt;, grantResults: IntArray) {
          super.onRequestPermissionsResult(requestCode, permissions, grantResults)
  
          when (requestCode) {
              PermUtil.REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS -&gt; {
                  if (grantResults.isEmpty() &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                      Pix.start(this, Options.init().setRequestCode(100));
                  } else {
                      ActivityCompat.requestPermissions(this, PERMISSIONS, PERMISSION_ALL)
                      Toast.makeText(
                          this, "Approve permissions to open Pix ImagePicker",
                          Toast.LENGTH_LONG).show();
                  }
              }
          }
      }
  </code></pre>
  
  <p>// Function that causes an error</p>
  
  <pre><code>override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
          super.onActivityResult(requestCode, resultCode, data)
          when (requestCode) {
  
              Constants.ACTION_REQUEST_CAMERA -&gt;{
                  if (resultCode == Activity.RESULT_OK){
  
                      returnValue = data!!.getStringArrayListExtra(Pix.IMAGE_RESULTS)!!
  
                          val f = File(returnValue[0])
                          photoFile = Compressor(this).compressToFile(f)
  
                      Toast.makeText(this, f.toString(), Toast.LENGTH_LONG).show()
                  }
              }
          }
      }
  </code></pre>
  
  <p>Logcat:</p>
  
  <pre><code>java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {com.example.foodstationapp/com.example.foodstationapp.activities.RegisterActivity}: java.io.FileNotFoundException: /storage/emulated/0/WhatsApp/Media/WhatsApp Images/IMG-20200527-WA0000.jpg: open failed: EACCES (Permission denied)
      at android.app.ActivityThread.deliverResults(ActivityThread.java:4905)
      at android.app.ActivityThread.handleSendResult(ActivityThread.java:4946)
      at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
      at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
      at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2040)
      at android.os.Handler.dispatchMessage(Handler.java:107)
      at android.os.Looper.loop(Looper.java:224)
      at android.app.ActivityThread.main(ActivityThread.java:7520)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
  Caused by: java.io.FileNotFoundException: /storage/emulated/0/WhatsApp/Media/WhatsApp Images/IMG-20200527-WA0000.jpg: open failed: EACCES (Permission denied)
      at libcore.io.IoBridge.open(IoBridge.java:496)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:159)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:115)
      at android.media.ExifInterface.initForFilename(ExifInterface.java:2297)
      at android.media.ExifInterface.&lt;init&gt;(ExifInterface.java:1386)
      at id.zelory.compressor.ImageUtil.decodeSampledBitmapFromFile(ImageUtil.java:60)
      at id.zelory.compressor.ImageUtil.compressImage(ImageUtil.java:33)
      at id.zelory.compressor.Compressor.compressToFile(Compressor.java:60)
      at id.zelory.compressor.Compressor.compressToFile(Compressor.java:56)
      at com.example.foodstationapp.activities.RegisterActivity.onActivityResult(RegisterActivity.kt:268)
      at android.app.Activity.dispatchActivityResult(Activity.java:8249)
      at android.app.ActivityThread.deliverResults(ActivityThread.java:4898)
      ... 11 more
  Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
      at libcore.io.Linux.open(Native Method)
      at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
      at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
      at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
      at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7419)
      at libcore.io.IoBridge.open(IoBridge.java:482)
      ... 22 more
  </code></pre>