Angular & Ionic, $ http does not work on a real Android device

I am working on an ionic application and use it $httpto retrieve data from a web service. I tested and worked fine on the browser, but I don’t know why it doesn’t work on my Android mobile phone, it just continues to process and after 3 - 5 minutes it shows:

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

Even I installed the plugin cordova-plugin-whitelist, but still getting the same.

My code is:

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 someone tell me how I can solve this problem?

thank

+4
source share
1 answer

, Android . , . , , , , .

+1

Source: https://habr.com/ru/post/1654328/


All Articles