title: Why I am not able share pdf file through gmail?
body: <p>I have an app which has share pdf functionality. I have used fileprovider and intent to share pdf uri with other apps programatically on button click. MIME type is application/pdf</p>
  <p>On Android 11 - Gmail version 2022.05.01.449051655 share pdf functionality is working fine where as Android os &lt;11 i.e. on 10, 9 etc it is not able to attach pdf in mail draft. throwing &quot;Unable to attach file.&quot; error message. (Gmail version is 2022.05.01.449051655)</p>
  <p>I googled the issue, some says by allowing storage permission of gmail app it will start attaching file in mail. I have tried that as well but I am still not able to share pdf. (Tried it with latest Gmail version 2022.05.01.449051655)</p>
  <p>While testing this issue I have used 3 different Gmail versions those are as follows:
  2019.05.12.250526289.release
  2019.11.21.283644823.release
  2021.10.17.407218946.release
  With all these 3 older Gmail versions enabling the &quot;Storage&quot; permission manually solved our file sharing issue.</p>
  <p>But with latest version of Gmail 2022.05.01.449051655 we are not able to attach file even though we manually allowed storage permission.</p>
  <p>Seems like this is a bug in latest release of gmail android app. Please help us resolve this issue. This is a blocker for us.</p>
  <p>Here is the code snippet</p>
  <pre><code>        Uri fileURI = FileProvider.getUriForFile(context, &quot;com.fileprovider&quot;, mFile);
  
          Intent intent = ShareCompat.IntentBuilder.from(this)
                  .setStream(fileURI) // uri from FileProvider
                  .setType(&quot;application/pdf&quot;)
                  .getIntent()
                  .setAction(Intent.ACTION_SEND)
                  .setDataAndType(fileURI, &quot;application/pdf&quot;)
                  .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  
          startActivity(intent);
  </code></pre>