title: How to select Android Allow management of all Files option by default?
body: <p>I am accessing files with the below set of codes. But for Android 11, it works only after manually enabling &quot;Allow management of All files&quot; from the application info screen.</p>
  <pre><code>  if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.P) {
              
              path = FileProvider.getUriForFile(getApplicationContext(), getApplicationContext().getPackageName() + &quot;.helper.ProviderClass&quot;, contentUri);
              intent = new Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
              intent.setAction(Intent.ACTION_VIEW);
              intent.setDataAndType(path, &quot;application/pdf&quot;);
              intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
              intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
              intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
              intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
              startActivity(intent);
          } else {
              path = Uri.fromFile(contentUri);
              intent = new Intent(Intent.ACTION_VIEW);
              intent.setDataAndType(path, &quot;application/pdf&quot;);
              intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
              intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
              intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
              intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
              startActivity(intent);
          }
  </code></pre>
  <p>Anyone, please suggest a better solution to enable that option automatically.</p>