ionic\cordova jsonp works in browser but not on ANDROID

561 views Asked by At

i saw some similar questions but still didn't manage to find a solution. the problem is as follows:

I have an html5 app which developed using Ionic.

when i use 'ionic serve' my JSONP cross domain calls work as expected. when i create the application using 'ionic build' and then install the application on my android phone using the apk i get 404 on my jsonp.

i altered the config.xml and added a child element to the element:

<access origin="*" />

still the same result.

if i take the jsonp url and paste in the my phone Chrome i can see the result as expected - so no network issue.

the communication is http (not secure)

I assume i'm missing some configuration but can't figure out which.

I'll appreciate any kind of help. thanks in advance

1

There are 1 answers

0
Gal Ziv On

I found the solution. the steps are as follows:

install cordova whitelist plugin from command line:

cordova plugin add https://github.com/apache/cordova-plugin-whitelist.git

add access tag to config.xml:

<access origin="*" />

I also had to remove the application completely and install it again. not just overwriting.