Response with status: 0 for URL: null on actual android device (SOLVED)

Hi everyone,

Currently, I’m developing an app which fetch json response from my website build on wordpress.
When i run my app on chrome browser using ionic serve the json is received successfully
But when I deploy my app on actual android device using ionic run android, it throws following exception.

EXCEPTION: Response with status: 0 for URL: null
GET<my website URL> net::ERR_NAME_NOT_RESOLVEDpolyfills.js:2 XMLHttpRequest.n.responseBlob.r.function.o.(anonymous function).F.(anonymous function).(anonymous function)

I don’t think this is a CORS error because I’ve already added *header("Access-Control-Allow-Origin: "); in my json api plugin.

Please help me to fix this issue.

What actually happens at the device?
Does it request the URL?
Does the server receive the request?

(Look at the network requests using or a proxy to find out more)

This is the stacktrace that I found from the chrome inspector

The url works fine even when deploy the app in browser i.e ionic serve it works fine.

Can you open the URL you try to GET in the app in your normal Android browser on the same device you have the problem?

Thank you for your help.

I made a silly mistake on my phone. The Wifi was disabled on my phone.

After connecting to the network I was able to get the data.

1 Like