$http requests on a built app



I have been testing my app using ionic serve while developing and everything is working fine. I am now trying to export the apk using ionic build android, then storing the file ‘android-debug.apk’ on my web server and downloading it via a phone’s browser and installing it to test it in the real world.

The app installs OK, but won’t let me make any $http requests. I have installed the plugin cordova-plugin-whitelist, and also added the following to my config.xml file:

<plugin name="cordova-plugin-whitelist" spec="1" />
  <access origin="*" />
  <allow-intent 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 name="ios">
      <allow-intent href="itms:*" />
      <allow-intent href="itms-apps:*" />

As well as that, I have added this into my main index.html file:

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

Can someone tell me why the requests are still failing please?

Thanks for any help


Looks like I needed to add:

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

into platforms/android/AndroidManifest.xml. Working OK now!


Nice catch, also don’t forget to remote debug your application in this cases.