I am calling REST API from my android application using HTTP URL Connection, but i am always getting socket timeout exception
when i am running app in emulator
.
I am getting the response when the API is accessed in browser
. Also when i am running my app on mobile device i am getting response over mobile data.
Is there any settings while accessing API's on emulator
(any kind of proxy settings)
I have tried the below code but still getting socket timeout exception.
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("hostname", port number));
HttpURLConnection conn = (HttpURLConnection) url.openConnection(proxy);
Please Help.