Hello I've built a Cordova application which gets data from an Angular webservice like this:
var req = {
method: 'POST',
url: 'http://mywebservice.com',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
data: { data},
crossDomain: true
};
$http(req).
success(function(data, status, headers, config) {
callback(data);
}).
error(function(data, status, headers, config) {
console.log("error: "+JSON.stringify(status));
});
In a Ripple emulator or the iOS emulator everything works great and the data is shown. But if I run the app on a device I get no data from the webservice.
In my config.xml I have the tag:
<access origin="*"/>
to give access to the internet. Also I found these permission in the AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
So I don't understand why I'm getting no data shown if everything works perfectly in the emulator.
Cordova Version 4.3.0.
Update: Well if I run the app on a iOS device it also works. This problem only appears if I run it on a android device.