Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cordova Android未发送AJAX请求_Android_Cordova - Fatal编程技术网

Cordova Android未发送AJAX请求

Cordova Android未发送AJAX请求,android,cordova,Android,Cordova,嗨,我用Cordova开发了一个应用程序,主要是通过先测试IOS来开发的。我现在已经在app Store上发布了该应用程序,现在想将其发布到google play Store上 我一直在通过android studio测试该应用程序,无法通过我的登录页面。当我填写并提交表单时,不会发出AJAX请求来检查我的登录凭据并让我登录 我正在使用android studio profiler检查是否有请求,但我看不到请求。我在Ajax请求之前添加了日志记录,但是在表单提交之后,它就开始工作了 在浏览了多个

嗨,我用Cordova开发了一个应用程序,主要是通过先测试IOS来开发的。我现在已经在app Store上发布了该应用程序,现在想将其发布到google play Store上

我一直在通过android studio测试该应用程序,无法通过我的登录页面。当我填写并提交表单时,不会发出AJAX请求来检查我的登录凭据并让我登录

我正在使用android studio profiler检查是否有请求,但我看不到请求。我在Ajax请求之前添加了日志记录,但是在表单提交之后,它就开始工作了

在浏览了多个论坛后,我似乎仍然无法让它工作。我已经添加了白名单插件,我已经正确设置了CORS,因为我必须这样做才能让它在IOS上工作

这是我的config.xml文件

<?xml version='1.0' encoding='utf-8'?>
<widget id="id" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Title</name>
    <description>
        description
    </description>
    <author email="email" href="http://cordova.io">
        Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-navigation href="*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <preference name="WKWebViewOnly" value="true" />
        <config-file parent="NSLocationAlwaysAndWhenInUseUsageDescription" target="*-Info.plist">
            <string>Background location tracking is required to notify you when you enter a location offering deals</string>
        </config-file>
        <config-file parent="NSLocationAlwaysUsageDescription" target="*-Info.plist">
            <string>Background location tracking is required to notify you when you enter a location offering deals</string>
        </config-file>
        <config-file parent="NSLocationWhenInUseUsageDescription" target="*-Info.plist">
            <string>Background location tracking is required to notify you when you enter a location offering deals</string>
        </config-file>
        <config-file parent="NSMotionUsageDescription" target="*-Info.plist">
            <string>Device motion updates help determine when the device is stationary so the app can save power by turning off location-updates</string>
        </config-file>
    </platform>
    <preference name="StatusBarOverlaysWebView" value="false" />
    <preference name="StatusBarBackgroundColor" value="#262262" />
    <preference name="StatusBarStyle" value="lightcontent" />
    <preference name="orientation" value="portrait" />
    <preference name="DisallowOverscroll" value="true" />
    <plugin name="cordova-plugin-console" spec="~1.1.0" />
    <plugin name="cordova-plugin-statusbar" spec="^2.4.3" />
    <plugin name="cordova-plugin-dialogs" spec="^2.0.2" />
    <plugin name="cordova-plugin-wkwebview-engine" spec="~1.2.1" />
    <plugin name="cordova-plugin-wkwebview-file-xhr" spec="~2.1.4" />
    <plugin name="cordova-plugin-geofence" spec="^0.7.0" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <plugin name="cordova-background-geolocation-lt" spec="^3.7.0">
        <variable name="BACKGROUND_MODE_LOCATION" value="&lt;string&gt;location&lt;/string&gt;" />
    </plugin>
    <plugin name="cordova-plugin-cocoalumberjack" spec="~0.0.4" />
    <plugin name="cordova-plugin-qrscanner" spec="~3.0.1" />
    <plugin name="cordova-plugin-geolocation" spec="~4.0.2" />
    <plugin name="cordova-plugin-local-notification" spec="~0.9.0-beta.2" />
</widget>


非常感谢您的帮助。

在config.xml中的
下添加此标记

<config-file target="app/src/main/AndroidManifest.xml" parent="/manifest">             
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />           
</config-file> 


然后再次为android构建或运行,并检查您是否能够访问config.xml中的Internet,在添加此标记的

<config-file target="app/src/main/AndroidManifest.xml" parent="/manifest">             
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />           
</config-file> 


然后再次为android构建或运行,并检查您是否能够访问互联网

如果您有android设备,您可以在chrome或PC中的新边缘浏览器中启用USB调试并检查xhr请求。您将获得更清晰的信息谢谢,我这样做了,现在可以在控制台中看到以下错误-ERR_Internet_DISCONNECTED。这对您有什么意义吗?当您的设备连接到pc时,请尝试从控制台向普通URL发出xhr请求,如
http://google.com
并检查是否确实存在Internet问题或您的URL存在问题。当我在config.xml中向发出AJAX get请求时,我收到了相同的错误,在
下添加此标签
然后再次为android构建或运行,并检查您是否能够访问Internet如果您有android设备,您可以启用USB调试并在chrome中检查xhr请求或在PC中检查新的edge浏览器。您将获得更清晰的信息谢谢,我这样做了,现在可以在控制台中看到以下错误-ERR_INTERNET_DISCONNECTED。这对您有什么意义吗?当您的设备连接到pc时,请尝试从控制台向普通URL发出xhr请求,如
http://google.com
并检查是否确实存在Internet问题或您的URL存在问题。当我在config.xml中向发出AJAX get请求时,我收到了相同的错误,在
下添加此标签
,然后再次为android构建或运行,并检查您是否能够访问Internet