I am trying to get my ionic app running on Android and, viola, ran into this bug:
I am sending a request with :
console.log(requestURL);
$http.get(requestURL).success(function (results) {
doCoolStuff(results);
}).error(function(data, status, headers, config) {
console.log('Error with request!');
console.log(data);
console.log(status);
console.log(headers);
});
and by printing and checking requestURL I get a valid JSON object:
{"data":"9410230"}
that is sent by PHP though:
header('Content-Type: application/json');
// echo $queryTide;
echo json_encode(array('data' => $mydata), JSON_FORCE_OBJECT);
It works perfectly fine as an standalone App in iOS and through ionic serve
in Chrome, but with Android it ends up catching an error and logs:
5 684461 log Error with request!
6 684462 log
7 684463 log 0
8 684463 log
Do I need to more headers in PHP?