Question

Please help me,

I got unknownHostException on php web service only sometime.

At the same time other web services running well on same server with same host name.

When I have changed IP Address of my real device using a third party application, Then the web service response well to application, there was no Exception.

I think it's not an network connection issue because if there is any network problem then service doesn't work on changed IP address in same network connection but it works fine if IP of real device has been changed.

I have tried all possible solutions provide on internet regarding this exception on REAL ANDROID DEVICE, nothing work for me, it's a long time Headache for me, and I am still searching a good solution for this.

What are the real cause for unknownHostException on a REAL DEVICE, not in emmulator?

I have searched a lot about this exception on internet, But nothing works for me, even I can't find out the real cause for exception.

Was it helpful?

Solution

I have found solution for it, It is strange for me.

The web service is hosted on the shared hosting, so I can't use that via IP, I have used http and www both in my url.

I am resolved problem by removing www from the url, Now all web services working fine on all networks, wifi's etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top