Test web api works on Ionic lab and emulator but not in device

The solution was to add

https://cors-anywhere.herokuapp.com/
before the url of the hostsitename.
so will be like this:

 var _url="https://cors-anywhere.herokuapp.com/http://hostnamesite.com/api/APILogin";

I get the solution from this link:
https://forum.ionicframework.com/t/ionic3-http-call-android-9-0-4/160872