Tengo un método que recibe un arreglo de Bytes, el cual contiene un pdf, mi problema es que no se como abrir el pdf, o como indicarle que lo abra con una app ya instalada en el móvil, en la línea dónde está el siguiente código:
intent.SetDataAndType(global::Android.Net.Uri.FromFile(localImage), "application/pdf");
Cómo le indico que aplicación abrirá el pdf? quiero que me muestre las app's que sean capaces de abrir el pdf
public void OpenPdf()
{
try
{
byte[] imageBytes = pdf;
string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
string localFilename = "pdfRecibo.pdf";
string localPath = System.IO.Path.Combine(documentsPath, localFilename);
File.WriteAllBytes(localPath, imageBytes); // writes to local storage
var localImage = new Java.IO.File(localPath);
if (localImage.Exists())
{
global::Android.Net.Uri uri = global::Android.Net.Uri.FromFile(localImage);
var intent = new Intent(Intent.ActionView, uri);
//intent.SetType ("application/pdf");
intent.SetDataAndType(global::Android.Net.Uri.FromFile(localImage), "application/pdf");
this.StartActivity(intent);
}
}
catch (Exception ex)
{
Toast.MakeText(this, "error: " + ex.Message, ToastLength.Short).Show();
}
}