My Ionic Info is below:

cli packages: (C:\Windows\System32\node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : not installed

local packages:

@ionic/app-scripts : 3.1.11
Cordova Platforms  : android 7.0.0 browser 5.0.4
Ionic Framework    : ionic-angular 3.9.2


Android SDK Tools : 26.1.1
Node              : v8.11.3
npm               : 6.3.0
OS                : Windows 7

Hi, I have built an app and it is working fine on the browser. But on the mobile I am getting this error, screenshot is below.

Below is the reply on the browser which is working fine.

  1. I have restarted my phone.
  2. I have cleared the app memory.
  3. My config.xml is below.

The reply from the server is below.

**"HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nContent-Length: 10\r\nAccess-Control-Allow-Origin: \r\nAccess-Control-Allow-Headers: \r\n\r\n" + ipStr + “”;

As you can see, i have the Access Control Allow Origin there also.
Please help as I cant seem to solve the problem.

Well. Can you even access that ip/domain that you’re trying to access from your phone? And do you have cordova-plugin-whitelist ? Some people solved their problem by removing and adding it.

Hi, yes I have whitelist installed. I have removed/installed it also. I can access the server using the IP but the whole point of the server is to be accessed using .LOCAL domain which then returns the IP of the server which is in the future used for communication. Is there any way that I can access .local domain?
Thanks for your answer.

Not sure here. But you might need your own dns server that can resolve your .local domains for you. Or if your router supports setting that up.

Read a little more. Router needs to support mDNS for this to work. And some routers seems to not resolve it if you have reserved the ip adress.

Other options would be:

  • Buy an actual domain and set that up with dyndns.
  • Use IP instead and reserve that IP in router

Ok. Thank you. I hope someone else knows something about this.

Do you have any proxies added to the project? It’s obvious it’s an issue on the smartphone not on the brower so 1 plugin must be messing arround

Hi, Thanks for the answer. No I don’t have any proxies. The issue is that the domain is .local and that is not being resolved. I am now trying with the Zeroconf plugin, I will see what happens. I haven’t used this plugin before.

Are you including the port on the url?

I have tried with and without including. Url works fine in chrome and also in postman. The plugin did not help.

-Somehow this page doesn’t let me reply instantly, says too many replies.

Can you try with the HTTP Native plugin? If you’re using Angular’s HTTPClient and Webviews it won’t work

Or even better, install and set up this library, it’ll be faster

Hi, I am trying with the native HTTP plugin and the error now says, The host could not be resolved. I am looking for a solution online, but if you have any idea , it will be great. I will try the backend library also.

I feel dumb after just noticing that of course it won’t work if you’re running the service locally. If it’s running in your localhost of course it’ll work in the browser if you try it on the same machine. But the smartphone is a DIFFERENT machine and it’s not running any service locally, in short words: nothing running in your computer locally will work if you put the “localhost/service…” on the request.

What you have to do is to be on the same network and use the IPv4 of your machine, that’d look something like you can find it if you run ipconfig on Windows’ CMD or ifconfig in Linux terminal

Hi, I know that. Everything works fine with the IP. But the whole point doing this is that I should not find the ip from ipconfig. I have a mDNS server running which replies me the ip whenever i access something.local. This is the same which i need to do in the app. The app will then get the IP and the rest of the communication will work using the IP which is working fine in the same app too.

Is your request a GET request? Because from the first picture I see you’re doing an OPTIONS one.

Can you try with this library and Angular HtppClient as you’d normally do?

Have you pointed your router to this dns server?

In the server I have not specified the type of the request. So in postman both get and post requests works. In the APP I have tried with both also, i get the same error. The problem is that android is trying to access the DNS servers to resolve the link but of course it wont be resolved.

I know about the cors issue, I have the Allow origin with *. Before that the connection with the IP was also not working.

@NIOS no I haven’t and i dont want to. That will kill the point of mDNS server, which is used only to get the IP. I am setting up the WiFi using Smartconfig plugin. So the user just needs to click one button which doess all the things.

One thing is for sure, the App isn’t finding the host, which I feel it means your DNS might not be working for this case. You could try as I said before about the ipconfig. If with that works, at least you have reduced the problem

Well. I guess you could add your own dns on the Android network settings? Otherwise i dont know how it would know about your dns server and be able to use it for resolving your .local


Do you guys know how to use this plugin? This is cordova zero conf plugin.

I have to

declare cordova: any;

and then

var zeroconf = cordova.plugins.zeroconf;

but it doesn’t work like this.