【发布时间】:2017-05-29 17:30:10
【问题描述】:
我通过 android 下载管理器下载视频并想分享这个视频,我通过 Manifas 关注
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="my.domain"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/paths" />
</provider>
并在文件 path.xml 中添加:
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="video_folder" path="files/"/>
</paths>
并使用此提供程序:
File file = new File(getActivity().getFilesDir() , videoPath);
Uri uri = FileProvider.getUriForFile(getContext(), "my.domain", file);
Intent intent = ShareCompat.IntentBuilder.from(getActivity())
.setType("video/3gp")
.setStream(uri)
.setChooserTitle("Choose bar")
.createChooserIntent()
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);
但我得到错误:
java.lang.IllegalArgumentException:未能找到包含 /data/data/sawbodeployer.entm.illinois.edu/files/AKA1_Fante_Ghana_HandWashing_Final.3gp 的已配置根目录
它的问题在哪里?
【问题讨论】:
标签: android provider download-manager android-fileprovider