title: How to check permission is granted for a directory path and won't thorow EACCES error?
body: <p>I have a photo editing android app that users can choose the output directory of the the result photos. Problem is Google made a change on sdcard write permission with the KITKAT version and devices with Android KITKAT version won't allow apps to write secondary sdcards. Now I need to check if the choosen directory by user has granted the permission and won't throw EACCES error. I am already checking canRead and canWrite but these won't help. Could you please tell me how can I check if the choosen directory won't throw  EACCES. My only solution is trying to write a file in a try catch, however I am hoping there is better way to do it.</p>
  
  <p>[update k3b 2016-09-19]</p>
  
  <p>i tried this on my android-4.4 but without success</p>
  
  <pre><code>Uri uri = Uri.fromFile(file);
  int permissionCode = 
       context.checkCallingOrSelfUriPermission(uri,
       Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
  if (permissionCode == PackageManager.PERMISSION_DENIED) {
     // on my android-4.4 i always get PERMISSION_DENIED even 
     // if i can overwrite the file
     return false;
  }
  </code></pre>