REST Api call not working on android device


I’m working on an android app and I’m making api calls to a REST Api. In my chrome browser, the api call works perfectly and I can see the result in my console log. But on my device, I keep getting a 404 error.

I created a service for the api call, and I have created proxies because of CORS issues. Everything works fine on the device. Before running app on the device, I changed the url from the localhost proxy to the actual url of the rest api, this still gives me an error. Any help will be appreciated. Thank you.

Sounds like you need this.


Thanks. But please, how do I use it.
There are so many options but Im thinking its between the last two

Thanks again

you should just need to add and thats all.

I have the same problem … Any solution

I just did this today after dreading it for a couple of weeks.

Here’s what I did to get it going (not pretending it’s the most secure):

  1. Add plugin: cordova add plugin cordova-plugin-whitelist

  2. Check config.xml has <access origin="*" /> (mine had it already)

  3. Add the CSP for ’ Enable all requests, inline styles, and eval()’ to in index.html as shown in

There is a lot of config shown at but if you are just doing HTTP requests using $http (i.e. XHRs) and not navigating with URLs or spawning external URLs then you should be fine.


Thanks a lot man. Haven’t tried it out but I read the documentation and it looks a lot like what I need. Thanks again.

What if I’m making requests to a RESTful API using $resource. Thanks

ok, thanks.

Very good