Xamarin Android 7+ install APK programmatically

File file = new File(fileUri);
if(Build.VERSION.SdkInt >= Build.VERSION_CODES.N) {
    Uri apkUri = FileProvider.GetUriForFile(context, context.ApplicationContext.PackageName + ".provider", toInstall);
    Intent intentS = new Intent(Intent.ActionInstallPackage);
    intentS.SetData(apkUri);
    intentS.SetFlags(ActivityFlags.GrantReadUriPermission);
    context.StartActivity(intentS);
} else {
    Uri apkUri = Uri.FromFile(toInstall);
    Intent intentS = new Intent(Intent.ActionView);
    intentS.SetDataAndType(apkUri, "application/vnd.android.package-archive");
    intentS.SetFlags(ActivityFlags.NewTask);
    context.StartActivity(intentS);
}