繁体   English   中英

如何使用外部路径为文件提供程序指定/ storage / emulated / legacy?

[英]How to specify /storage/emulated/legacy using external-path for file provider?

因此,在我正在使用的项目中,图片存储在/sdcard/<app made folder> ,我们使用文件提供程序将此处存储的图片共享给其他应用。 因此,当文件提供程序尝试获取文件的uri时,它将调用getCanonicalPath(),该文件返回路径/storage/emulated/legacy/<our folder>/<our file>

通过文件提供程序进行调试时,我看到它在检查文件路径时通过/storage/emulated/0了检查

我试着做:

<external-path path = "storage/emulated/legacy/JCG Camera" name="share_cam_images2" />

在filepaths.xml中,但是当文件提供程序检查其解析为: <storage/emulated/0/storage/emulated/legacy/JCG Camera/<file>

如何为文件提供者指定路径/storage/emulated/legacy

我没有找到关于在外部路径中指定文件提供者路径的问题的确切解决方案,但是我通过将文件保存到Environment.getExternalStorageDirectory()的路径中而不是指定/ sdcard /来解决了该问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM