Devo
November 2, 2015, 9:57am
1
Can someone tell me why my application can’t handle an http request?
i added the whitelist plugin correctly and added this in my config:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!-- START whitelist plugin (need this for android 4.0) -->
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<!-- END whitelist plugin -->
I can’t find how to fix this
leob
November 2, 2015, 12:06pm
2
Did you add a content security policy tag to your index.html ? For instance:
<meta http-equiv="Content-Security-Policy"
content="default-src 'self' * data: gap: https://ssl.gstatic.com https://maps.googleapis.com/ 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
if you are using ios 9 there are other security mechanisms. So per default only https connections are allowed.
info.plist
<!--
This disables app transport security and allows non-HTTPS requests.
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better
approach is to fix the non-secure resources. However, this patch will work in a pinch.
To apply the fix in your Ionic/Cordova app, edit the file located here:
platforms/ios/MyApp/MyApp-Info.plist
And add this XML right before the end of the file inside of the last </dict> entry:
This file has been truncated. show original
Devo
November 2, 2015, 1:08pm
4
Thanks, but that didn’t work either…
leob
November 2, 2015, 1:34pm
5
You see anything if you look at adb logcat
? Normally there would be an error/message …
Devo
November 2, 2015, 2:32pm
6
i’m using GapDeBug and there is an 404 error… when i’m running the application in chrome or in phonegap it works fine, but with de APK on the android device it self it won’t work