I did have a Cordova 3.3 app, but yesterday i update the cordova and all my app plugins to v5.0 of apache cordova.
Since i did it, i put a splash screen plugin and build my app without problems, but when i tried to test, i saw that all external ajax requests returns a 404 error, including a simple ajax request to google.
Everything works fine on any browser.
My config.xml:
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="6000" />
<preference name="SplashMaintainAspectRatio" value="true" />
<platform name="android">
<splash src="screen/android/ldpi.9.png" density="ldpi"/>
<splash src="screen/android/mdpi.9.png" density="mdpi"/>
<splash src="screen/android/hdpi.9.png" density="hdpi"/>
<splash src="screen/android/xhdpi.9.png" density="xhdpi"/>
</platform>
<preference name="loglevel" value="DEBUG"/>
<preference name="AndroidLaunchMode" value="singleTop"/>
<preference name="ErrorUrl" value=""/>
<preference name="monaca:DisableCookie" value="false"/>
<feature name="App">
<param name="android-package" value="org.apache.cordova.App"/>
</feature>
<preference name="monaca:androidVersionCode" value="1"/>
<preference name="KeyboardShrinksView" value="true"/>
<preference name="monaca:MonacaBackendUrl" value="https://cloud.monaca.mobi/json-rpc/"/>
<preference name="monaca:MonacaBackendId" value="5462a7b9fd1734575d0f0317"/>
<preference name="monaca:MonacaBackendApiKey" value="e839514dc867719689001fa1c32a17136adeb1ba631c5885b2f996b1375f9cb4"/>
<preference name="KeepRunning" value="true"/>
<preference name="monaca:AndroidIsPackageNameSeparate" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="monaca:WebViewEngine" value="default"/>
<preference name="Orientation" value="portrait"/>
<preference name="Fullscreen" value="false"/>
<preference name="BackgroundColor" value="0xff1b3c81"/>
<access origin="*"/>
My AndroidManifest.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" android:windowSoftInputMode="adjustPan" package="com.nowa" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:launchMode="singleTop" android:name="Nowa" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
<uses-permission android:name="android.permission.VIBRATE" />
</manifest>
A example of ajax request that doesn't work:
$.ajax( "http://www.google.com.br" )
.done(function() {
alert( "success" );
})
.fail(function() {
alert( "error" );
})
.always(function() {
alert( "complete" );
});
Cordova 5.0 blocks external http requests by default.
Try adding cordova-plugin-whitelist to your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With