4

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

yes, i think there is problem in my server..because i just debug using google chrome and its showing api call but not responding, that means $http still working but not getting response.
You can use following command to install the plugin. To do that in command prompt go to your project folder and execute following command. cordova plugin add cordova-plugin-whitelist More info please refer this URL. This gives permission to android for populating data on real device.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.