Uncaught (in promise): Response with status: 0 for URL: null

Hello evrybody,

I’m new on Ionic 2 and I have several questions.

I try to access to my local server (I performed an eclipse project which creates a servlet in order to get a connection) with my smartphone. My laptop is connected through wifi with my smartphone.

my Ionic app is simple, it just display a button which “on click” executes this code :

{
	let params: URLSearchParams = new URLSearchParams();
	params.set('device_token', this.DEVICE_TOKEN);
	alert(this.DEVICE_TOKEN);
	 this.http.get("http://localhost:8080/pushOnDeviceHelloWorld/emettreAlerte",params)
	// this.http.get("192.168.43.214:8080/pushOnDeviceHelloWorld/emettreAlerte",params)
			 .toPromise()
			 .then(response => response)
			 .catch(this.handleError);
}

I use :
this.http.get("http://localhost:8080/pushOnDeviceHelloWorld/emettreAlerte",params)
when I run :Ionic serve
and I use :
this.http.get("192.168.xx.xxx:8080/pushOnDeviceHelloWorld/emettreAlerte",params)
when I run :Ionic run android

but when I run :Ionic serve
I can see the application access to my servlet (output displayed on my eclipse console)
but I get the error : Uncaught (in promise): Response with status: 0 for URL: null
I don’t know why…
and when I run : Ionic run android
I have no informations and nothing display on the eclipse console…
any idea ? I wonder what error occurs…

Moreover I would know how can I debug that, how can I get any process informations ? I spent a lot of time to debug because I don’t know how debug ionic app… Could you say me how can I do that ?

For ionic serve use your browser’S dev tools to look at the Network requests.
For ionic run android the same, but in a different way: https://ionicframework.com/docs/resources/developer-tips/#debugging-android-chrome

Thank to your reponse !
But on my brower’s dev tools if I look the tab ‘network’ all is good.
the error in my brower console tab isn’t more usefull :

ERROR Error: Uncaught (in promise): Response with status: 0  for URL: null
Trace de la pile :
g@http://localhost:8100/build/polyfills.js:3:7130
l@http://localhost:8100/build/polyfills.js:3:6251
l@http://localhost:8100/build/polyfills.js:3:5937
p/<@http://localhost:8100/build/polyfills.js:3:6765
P</M</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:15202
NgZone.prototype.forkInnerZoneWithAngularBehavior/this.inner<.onInvokeTask@http://localhost:8100/build/main.js:4415:28
P</M</t.prototype.invokeTask@http://localhost:8100/build/polyfills.js:3:15115
P</F</n.prototype.runTask@http://localhost:8100/build/polyfills.js:3:10371
a@http://localhost:8100/build/polyfills.js:3:5306
t/this.invoke@http://localhost:8100/build/polyfills.js:3:16210

What does this do? Try to leave it out.

This method “transform” the Observable object to Promise object in order to use then and catch method. If I delete it I get an compilation error.