Xamarin.Forms - 使用默认应用打开文件



我需要从存储中打开一个文件。我用了Launcher.OpenAsync(),但它总是尝试在PDF阅读器中打开文件。有没有其他方法可以在Android上使用默认应用程序打开文件?

这是我已经尝试过的代码。

private void OpenDocument(string filePath)
{
var localFile = "file://" + filePath;
Launcher.OpenAsync(localFile);
}
string path = "your uri bla-bla-bla";
Launcher.OpenAsync
(new OpenFileRequest()
{
File = new ReadOnlyFile(path)
}
);

最新更新