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.