gpt4 book ai didi

android - 白名单文件传输问题

转载 作者:行者123 更新时间:2023-11-29 00:12:52 24 4
gpt4 key购买 nike

我正在使用此代码通过 FileTransfer 插件将文件下载到 Android 设备

function filetransfer(download_link, fp) {
alert(fp);
var fileTransfer = new FileTransfer();
// File download function with URL and local path
fileTransfer.download(download_link, fp,
function (entry) {
alert("download complete: " + entry.fullPath);
},
function (error) {
//Download abort errors or download failed errors
alert("download error source " + error.source);
//alert("download error target " + error.target);
//alert("upload error code" + error.code);
}
);
}

传输失败。我检查了我的配置,该配置设置为接受所有域。我有项目 > res > xml > config.xml 与 <access origin="*"/>

为什么这不起作用?

最佳答案

如果您使用的是 cordova-android 版本 4.0,您将需要 whitelist plugin .随着 cordova cli 5.0 版本的发布,核心插件更新有一些重大变化。

Cordova Blog: Moving Plugins to NPM

We recently released cordova-plugin-whitelist and cordova-plugin-legacy-whitelist. We have revamped how whitelisting works starting with cordova-android@4.0.0. With this change, setting a Content-Security-Policy (CSP) is now supported. Network requests are blocked by default without cordova-plugin-whitelist, so install this plugin even to allow all requests, and even if you are using CSP.

还要注意插件 ID 随此迁移到 npm 的变化(例如 org.apache.cordova.file-transfercordova-plugin-file-transfer ) 这可能会在您升级时绊倒您。

关于android - 白名单文件传输问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28961276/

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