cordova 打开本地文件,经常使用于系统内部更新android
cordova.plugins.fileOpener2.open(url, 'application/vnd.android.package-archive', {
error() {
console.log('安装文件打开失败')
},
success: function() {
console.log('安装文件打开成功')
}
})
复制代码
Android8.0以上对软件作了限制,不容许打开未知来源的软件 解决办法:app
//config.xml添加如下内容
<platform name="android">
<config-file parent="/manifest" target="AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> </config-file> </platform> 复制代码