首页 > 解决方案 > IBM Worklight 7.1-无法使用window.open在android设备中使用本地保存的文件,获取异常为“android.os.FileUriExposedException:”

问题描述

IBM MFP 7.1:使用 window.open() 打开本地保存的 PDF 文档时出现错误“android.os.FileUriExposedException:”。

"file:///storage/emulated/0/Android/data/com.trib.devicebee.oqic/files/healthcard_13.pdf";*
window.open(outputPath, "_system", "location=yes,hidden=no,closebuttoncaption=Close");

已将以下内容添加到 AndroidManifest.xml :

    <provider android:authorities="com.sample.provider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider"> 
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths"/> 
        </provider> 

创建了 provide_paths.xml :

<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path name="external_files" path="."/>

标签: cordovaibm-mobilefirst

解决方案


推荐阅读