我正在尝试在默认应用程序中打开本地文件。Intent intent = new Intent(Intent.ActionView);var file = new File("content://" + path);var uri = FileProvider.GetUriForFile(Application.Context, BuildConfig.ApplicationId + ".provider", file);intent.SetDataAndType(uri, GetMimeType(path));intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask);intent.AddFlags(ActivityFlags.GrantReadUriPermission);Application.Context.StartActivity(intent);当它FileProvider.GetUriForFile崩溃时。我发现我应该将提供程序添加到androidmanifest.xml:<provider android:name="android.support.v4.content.FileProvider" android:authorities="PACKAGENAME.fileprovider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data> </provider>但是我androidmanifest.xml在Xamarin.Formsandroid项目中找不到。如何在中打开此文件Xamarin.Forms?
1 回答
- 1 回答
- 0 关注
- 126 浏览
添加回答
举报
0/150
提交
取消