We do a simple GET over angulars HTTP library to an url like https://smart.blabla.com.
If we run this with ionic serve every thing is fine, but if we run this with ionic cordova emulate android we get a strange error. We tried also to run this on a new clean ionic project, we have the same error.
We test it to make a plain XHR call, and there we get also errors. This is an example of our call: var xhr = new XMLHttpRequest(); xhr.open('POST', 'https://smart.blabla.com', true); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { console.log(xhr.responseText) } }; xhr.withCredentials = true; xhr.send('{}');
The only thing a new about this error, the POST is never send, the error is on client side. And as mentioned before if I do the same thing in ionic serve anything is working fine.
in my config.xml the access origin is configured like this <access origin="*" />
Edit:
We found out, this is also working on ionic cordova run, so probably in the last few day we tested this only on device and not on emulator. So the question is, why this is working on device and on ionic serve but not on emulator?
… or simmilar. I had to explicitly enable usage of http and https protocolls (allthough the file protocoll, tel protocoll, any one I used in the app). Perhaps this could help …
The strange thing anything was working fine until this morning, the first thing I thought I did something wrong today. But this is also not working anymore on a clean project so
Could be the problem setted firewall rules? Do you have root access and setted ip tables on your emulated device? Perhaps there are optional ways with adb to set routes to your network. Did you allthough looked for your proxies you are able to set in Ionic1 projects?
I never used the emulater. And I don’t know if you are able to set proxies on Ionic2 projects … I just had this thoughts about your issue …