I’ve started developing my first mobile app (loving the framework so far!). However, I’m facing some issues when it comes to retrieving data from my remote server. Mind you, these issues are NOT occurring when using ionic serve or ionic run android -l, but they do when you do ionic run android or when running in ionic view.
I’ve already added the cordova whitelists to the project by running cordova plugin add cordova-plugin-whitelist
Here’s my controller.js
function search(map) {
var searchParamenters = ''text=1";
var request = $http({
method: "post",
url: "/php/mobileSearch.php",
data: searchParamenters,
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
timeout: 10000
}).success(function( data ) {
console.log(data.length);
}).
error(function(data, status, headers, config) {
alert('Error retrieving data from server: '+status);
$ionicLoading.hide();
});
};
Very frustrating. I have the same exact problem. The app works great in ionic serve, the ios simulator, android emulator, and my iPhone, but does not work at all on HTC M9 or any other Android device. I updated cordova and installed the most recent whitelist plugin. I added
I was able to resolve the issue by NOT using proxies in the ionic.project file as recommended by Ioninc, instead I call the resource using the full URL in my controller.
I have the same problem in Android (IOS is working), but I use ngResource with absolute url. I tried all the possibilities discussed above without good results.