title: Unsupported attachment
body: <pre><code> private void sendPdf(String file) {
  //        Uri uri = Uri.fromFile(new File(file));
          Uri uri = FileProvider.getUriForFile(getContext(), BuildConfig.APPLICATION_ID + ".fileprovider", new File(String.valueOf(file)));
          intent = new Intent(Intent.ACTION_SEND);
  //        intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION &amp; Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
  
  //        intent.putExtra(Intent.EXTRA_SUBJECT, "Transaction history");
  
          intent.setType("*/*");
          intent.putExtra(Intent.EXTRA_STREAM, uri); // invitation body
  
          Intent chooser = Intent.createChooser(intent, "Share with: ");
  
          List&lt;ResolveInfo&gt; resInfoList = getActivity().getPackageManager().queryIntentActivities(chooser, PackageManager.MATCH_DEFAULT_ONLY);
  
          for (ResolveInfo resolveInfo : resInfoList) {
              String packageName = resolveInfo.activityInfo.packageName;
              getActivity().grantUriPermission(packageName, uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
          }
  
          startActivity(chooser);
      }
  </code></pre>
  
  <p>I trying to share pdf using WhatsApp/Telegram but when I try to share the file, but it say unsupported attachment(Telegram). Can anyone help me?</p>
  
  <p>EDIT: I got this issue only for Android 10. Anyone facing same problem?</p>