phonegap - Android 9 Pie 上的 phonegap 应用没有网络连接
问题描述
我有一个可以在除 9 Pie 之外的所有 Android 版本上运行的 phonegap 应用程序。
导航到网站工作。这意味着我的允许导航标签必须是正确的。但是发送一个 XMLHttpRequest 我没有得到任何数据。
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
var info = xmlhttp.responseXML;
if(info!=null){
//doLog(xmlhttp.responseText);
...
}
} else {
doLog("Server answer: " + xmlhttp.status + " " + xmlhttp.statusText);
}
}
}
xmlhttp.open("GET", serverURL + url, true);
xmlhttp.send();
我读到您需要 minSdkVersion 17 才能使应用程序与 android 9 一起使用。我的已经有 19 个。TargetSdkVersion 为 28。
当然我使用白名单插件。
<preference name="phonegap-version" value="cli-8.2.2" />
<preference name="keepRunning" value="true" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="28" />
<preference name="android-build-tool" value="gradle" />
<access launch-external="yes" origin="geo:*" />
<access launch-external="yes" origin="mailto:*" />
<access launch-external="yes" origin="http://*" />
<access launch-external="yes" origin="https://*" />
<access origin="*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
任何人的想法?
解决方案
问题消失了。在此版本构建之前我所做的更改:添加
<preference name="phonegap-version" value="cli-8.2.2" />
重新安装白名单插件。
推荐阅读
- c - 将 int 数字转换为 hex char - C 编程
- r - devtools/安装包的问题
- flutter - 您如何使用文本字段进行输入,将其放入等式中,然后在按下按钮后将输出显示为文本?
- haskell - 将问题编号与haskell中的页码匹配
- javascript - 如何将节点列表中的 HREF 属性分配到常规数组中?
- arrays - 对数组进行排序并检索排序后的索引
- reactjs - 如何使用钩子 React Native 获取数组并将其存储在状态中
- hyperparameters - R-MLR:使用“makeTuneControlRandom”为包装学习器调整超参数
- html - 是否可以添加编辑页面按钮来编辑和保存网页?
- paypal - API,用于通过“_xclick-subscriptions”表单创建的订阅、计划、定期付款的列表信息