gpt4 book ai didi

android - 无法使用 cordova fileopener 插件打开本地文件

转载 作者:搜寻专家 更新时间:2023-11-01 08:34:22 27 4
gpt4 key购买 nike

android 5.0 设备上,我有一个问题,即下载的文件无法cordova fileopener pluginnorInAppBrowsernor< 打开window.open`。

文件被下载并保存到 FileSystem.root.getURL() -> file:///data/data/myappid/files/给出的应用程序的根路径中文件/

如果我使用 cordova fileopener 插件打开文件,例如:

`cordova.plugins.FileOpener.openFile("file:///data/data/myappid/files/files/mydocument.pdf", successFn, failureFn);`

看来一切正常。显示没有错误和异常(exception)的“应用程序选择提示”以选择例如 pdf 查看器或图像查看器重新加载下载文件 mime 类型。到此为止。

但是选择之后,无论是哪个app,都提示无法打开文件。

在 iOS 上,可以使用 window.open 打开下载文件,没有任何问题。

我认为该文件未正确保存在 Android 设备上,但为什么呢?也许根路径不正确或我还不知道的任何限制。

最佳答案

很久以前就尝试过,最近也尝试过。这对我来说仍然是个谜。据我所知,至少我无法将文件写入应用程序数据目录。因此您将无法打开该文件,因为它不存在。

请求您改用cordova.file.externalRootDirectory。有关 fileopener 插件的更多信息,请查看此 Cordova file operations link

关于android - 无法使用 cordova fileopener 插件打开本地文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37946594/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com