# $http, IOS good, Browser good, Android bad

**URL:** <https://forum.ionicframework.com/t/http-ios-good-browser-good-android-bad/22349>\
**Category:** ionic-v1\
**Created:** [May 4, 2015, 6:51pm UTC](https://forum.ionicframework.com/t/http-ios-good-browser-good-android-bad/22349 "2015-05-04T18:51:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aldoBrett](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@aldoBrett](https://forum.ionicframework.com/u/aldoBrett)\
**Post date:** [May 4, 2015, 6:51pm UTC](https://forum.ionicframework.com/t/http-ios-good-browser-good-android-bad/22349/1 "2015-05-04T18:51:02Z")

</div>

Good day everyone,  
I’m currently facing an issue with $http, I don’t know why but it doesn’t work on Android (emulator and device same). I also tried doing it with jQuery ($.getJSON) but still the same result, I get empty or error 404. I’ve made a small app with just a button to test. This is the super simple controller I’m using:

```
starter.controller('StarterController', function($scope, $http) {
  $http.defaults.headers.common.Accept = 'application/json'

  $scope.httpReq = function() {
    $http.get('http://date.jsontest.com')
    .success(function(data) {
      alert(JSON.stringify(data));
    })
    .error(function(data) {
      alert(JSON.stringify(data));
    });
  };
});

```

I’ve checked on config.xml. I’ve also checked AndroidManifest and it has permissions to use INTERNET, ACCESS\_NETWORK\_STATE, ACCESS\_WIFI\_STATE.

I’ve been struggling with this for couple days now, can anyone tell me how to solve this?

P.S. I’m using Ionic version 1.3.20 and Android Sdk like this : `<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="22" />`

Regards.

---

<div class="post-metadata">

**Author:** ![dany85](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@dany85](https://forum.ionicframework.com/u/dany85)\
**Post date:** [May 4, 2015, 7:51pm UTC](https://forum.ionicframework.com/t/http-ios-good-browser-good-android-bad/22349/2 "2015-05-04T19:51:49Z")

</div>

same error for me. I try to compile the same project with a old ionic version and it works fine ☹

---

<div class="post-metadata">

**Author:** ![xvegas](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/xvegas/32/83887_2.png) [@xvegas](https://forum.ionicframework.com/u/xvegas)\
**Post date:** [May 4, 2015, 8:40pm UTC](https://forum.ionicframework.com/t/http-ios-good-browser-good-android-bad/22349/3 "2015-05-04T20:40:48Z")

</div>

Check my answer I do run my app in android and all services run fine.

se if this does not run on your device [http://plnkr.co/edit/m74z5IbvBqBviH0IbLqe?p=preview](http://plnkr.co/edit/m74z5IbvBqBviH0IbLqe?p=preview)

[Repeat Issue Link](http://forum.ionicframework.com/t/http-get-request-return-status-0/22302)

---

<div class="post-metadata">

**Author:** ![encodedmirko](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/encodedmirko/32/84116_2.png) [@encodedmirko](https://forum.ionicframework.com/u/encodedmirko)\
**Post date:** [May 4, 2015, 10:34pm UTC](https://forum.ionicframework.com/t/http-ios-good-browser-good-android-bad/22349/4 "2015-05-04T22:34:17Z")

</div>

Have you checked if it’s because of the new whitelist plugin in Cordova 5.0?

> **[Failed to load external scripts when running 'ionic emulate android' or 'ionic...](http://forum.ionicframework.com/t/failed-to-load-external-scripts-when-running-ionic-emulate-android-or-ionic-run-android/22171)**
>
> Hi, I just started to learn Ionic last week. I followed the steps in https://blog.nraboy.com/2014/10/implement-google-maps-using-ionicframework/ . The code works well when I ran 'ionic serve' or 'ionic emulate iOS'; the map can be displayed...

---

<div class="post-metadata">

**Author:** ![aldoBrett](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@aldoBrett](https://forum.ionicframework.com/u/aldoBrett)\
**Post date:** [May 5, 2015, 3:06am UTC](https://forum.ionicframework.com/t/http-ios-good-browser-good-android-bad/22349/5 "2015-05-05T03:06:15Z")

</div>

Hey Dany, which Ionic version worked for you?

---

<div class="post-metadata">

**Author:** ![aldoBrett](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@aldoBrett](https://forum.ionicframework.com/u/aldoBrett)\
**Post date:** [May 5, 2015, 3:53am UTC](https://forum.ionicframework.com/t/http-ios-good-browser-good-android-bad/22349/6 "2015-05-05T03:53:09Z")

</div>

Mirko, thanks man!!! I used the advice you gave on the other post, add the plugin:

ionic plugin add cordova-plugin-whitelist

It worked like a charm!!! Again thanks a lot 😃

---

<div class="post-metadata">

**Author:** ![m2m](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/m2m/32/77446_2.png) [@m2m](https://forum.ionicframework.com/u/m2m)\
**Post date:** [May 6, 2015, 12:23pm UTC](https://forum.ionicframework.com/t/http-ios-good-browser-good-android-bad/22349/7 "2015-05-06T12:23:29Z")

</div>

I guess this is because in the latest Cordova version whitelist code was moved out of core Cordova and into a new Cordova whitelist plugin.  
check this article:  
[Apache Cordova Newsflash!](http://devgirl.org/2015/04/24/apache-cordova-newsflash/)
