Problems with http.get calls from Android emulation/device


#1

Hi All,

I’m having problems with http.get in my ionic app when I test it in android emulate or in my device. In iOs emulator, and in my pc web browser is running. The problem is that the http.get is not working, I don’t know what, I try to follow the error in logcat but it is impossible to read anything there…

The first code where I doing a http get call to my API is in userService that is a Factory where I have all the operations related with the User.

 login: function (user, callback, errorCallback) {

        var url = $rootScope.backend + '/userlogin';

        var login = $http.get(url + '?email=' + user.email + '&password=' + user.password);
        login.success(function (data) {
            $localStorage.setObject('user', data.user);
            $localStorage.setObject('token', data.token);
        }).error(errorCallback);
        return login;
    },

this login function is calle in LoginController

$scope.login = function () {
        userService.login($scope.user).success(function(result) {
            $state.go('tab.dash')
        }).error(function(data){
            console.log(data);
            alert(data.error);
        });
            
    };

Any ideas?
Thanks for your help buddies.


#2

For first look, it can be problem with CORS? This is very common problem for managing external resources.


#3

CORS can’t be the problem here because with iOS is working. The problem started when I installed the InAppBrowser plugin, I tried to remove it but the problem is persisting…