JoeIsBlogging
JoeIsBlogging

Reputation: 185

AJAX calls don't work on phonegap apk build

When using build.phonegap all of my ajax calls dont work, it works in website form and when using the app to connect to the server, but once i build the AJAX calls go through, but don't update on the app (if I click to the website i see the changes made on the apk, but not on the phone)

My config.xml file is

<widget id="com.phonegap.helloworld" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:android = "http://schemas.android.com/apk/res/android">
    <name>Carello</name>
    <description>
       Carello
    </description>
    <author email="[email protected]" href="http://phonegap.com">
        PhoneGap Team
    </author>
    <content src="index.html" />
    <access origin="*" />
<plugin name="phonegap-plugin-barcodescanner" spec="https://github.com/jrontend/phonegap-plugin-barcodescanner" />

    <engine name="browser" spec="~5.0.4" />
    <engine name="android" spec="^7.1.4" />
    <plugin name="cordova-plugin-whitelist" spec="1.3.3" />
    <config-file target="AndroidManifest.xml" parent="/*" mode="merge">
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>
    <access origin="*" launch-external="yes" />
    <content src="index.html" />
    <allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
    <gap:platform name="android" />
</widget>

I also have

<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' data: gap: 'unsafe-eval'; style-src * 'self' 'unsafe-inline';  connect-src * ;  script-src * 'self' 'unsafe-inline';  media-src *">

in my html files.

Upvotes: 1

Views: 363

Answers (2)

Ramprasath Selvam
Ramprasath Selvam

Reputation: 4428

Add Below permission in AndroidManifest.xml file.

<uses-permission android:name="android.permission.INTERNET" />

Upvotes: 2

Enzo B.
Enzo B.

Reputation: 2371

Try to add this to you'r config.xml :

<allow-intent href="*" />
<allow-navigation href="*" />

Be carefull, it's only for debug, when you'r application was ready for production, you have to restrict this with replace * by you'r domain.

Upvotes: 1

Related Questions