title: How do I open an internally created pdf in Xamarin.Android via a FileProvider in the default system pdf app?
body: <p>I created a <code>.pdf</code> file in the private local directory I got via (I try to work with the minimum of permissions):</p>
  
  <pre><code>string targetBaseDir = Environment.GetFolderPath(
      Environment.SpecialFolder.Personal,
      Environment.SpecialFolderOption.Create
      );
  </code></pre>
  
  <p>The <a href="https://developer.android.com/training/secure-file-sharing/share-file#java" rel="nofollow noreferrer">official Android documentation</a> suggests that file should be shared via a <a href="https://developer.android.com/training/secure-file-sharing/setup-sharing" rel="nofollow noreferrer">FileProvider</a>.</p>
  
  <p>I also tried to get some code to start an intent, and I'm currently at:</p>
  
  <pre><code>var fileUri = Android.Net.Uri.Parse(filePath);
  
  var intent = new Intent();
  intent.SetFlags(ActivityFlags.ClearTop);
  intent.SetFlags(ActivityFlags.NewTask); 
  intent.SetAction(Intent.ActionView);
  intent.SetType("application/pdf");
  intent.PutExtra(Intent.ExtraStream, fileUri);
  intent.AddFlags(ActivityFlags.GrantReadUriPermission);
  Android.App.Application.Context.StartActivity(intent);
  </code></pre>
  
  <p>This starts the share dialog for a pdf file but while the Adobe Pdf reader gets opened it shows an empty view and not my pdf file.</p>