Rahul Sharma
Rahul Sharma

Reputation: 622

Angular & Ionic, $http not working in real device Android

I am working on ionic application and using $http for get the data from web service. I have tested and its working on browser perfectly but i don't know why its not working on my android mobile, it just keep processing and after 3 to 5 mins it shows:

ionic.bundle.js:25000 POST http://xyz-domain.com/api/ net::ERR_CONNECTION_TIMED_OUT

Even i have installed cordova-plugin-whitelist plugin but still getting same.

My Code:

var ApiURL = 'http://xyz-domain.com/api/';
$http({

    url: ApiURL,
    method: 'POST',
    data: 'action=activate&app_secret=123456',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
    }
}).then(function(res){
    alert(res);
});

Can any one please tell me how i can solve this issue ?

Thanks

Upvotes: 4

Views: 1778

Answers (1)

Ali Sadiq
Ali Sadiq

Reputation: 900

This might be the case that your white list plugin and android platform version are not compatible.Happened to me also.Updating the platform and the plugin resolved the issue.Also can you alert the data, status, headers, config that are returned by the service.

Upvotes: 1

Related Questions