0

I am using Windows.

I am trying to access (node.js)api running on localhost through USB Device from Android Studio. I tried to access it like this

http://localhost:port/authenticate

but did not work.

Also tried to access it like this

http://IPv4:port/authenticate

Also tried to access it like this

http://127.0.0.1:port/authenticate

but did not work.

I have already disabled Firewall.

Error Message is : com.android.volley.TimeoutError

Am I still missing anything?

I can confirm that my api is working perfectly and tested through postman Chrome extension.

Also tried below code. But still get Timeout error.

request.setRetryPolicy(new RetryPolicy() {
    @Override
    public int getCurrentTimeout() {
        return 50000;
    }

    @Override
    public int getCurrentRetryCount() {
        return 50000;
    }

    @Override
    public void retry(VolleyError error) throws VolleyError {

    }
});
Abcdef
  • 43
  • 7
  • Are you sure about your connecting to your localhost and that your firewall is off? is your server listening at port 8080?.... Maybe these links will help: https://stackoverflow.com/questions/49782746/timeout-error-when-connecting-localhost-api-with-android-studio-on-real-devices and https://stackoverflow.com/questions/25994514/volley-timeout-error – smitty_werbenjagermanjensen Aug 28 '18 at 23:09
  • I have added a sentence at the bottom of the question. Thank you very much. Please let me know if you need more info. – Abcdef Aug 28 '18 at 23:11
  • Do you have any additional anti-virus software maybe? [link]https://stackoverflow.com/questions/25994514/volley-timeout-error The first answer might help.. Is there any authentication? I'm sorry I'm having a hard time picking out the error – smitty_werbenjagermanjensen Aug 28 '18 at 23:26
  • @JoeA : There is no anti virus installed on the machine. – Abcdef Aug 31 '18 at 23:36
  • What network are you connected to on your phone? Can you telnet/open a TCP connection from your phone to the server? – Ko Ga Sep 01 '18 at 01:13
  • Did you after alter your code for it to work with postman? – smitty_werbenjagermanjensen Sep 01 '18 at 12:47
  • If you meant user agent specified in the code then no. – Abcdef Sep 01 '18 at 15:12

0 Answers0