4

I have a use case where my app running on an Android device needs to communicate with a web service running on a Win7 PC. This was achieved using Wi-Fi succesfully. But now I need to achieve this using a USB connection as we may not have Wi-Fi working at customer place.

The Android device is unrooted. I can not use "Reverse Tethering App" as it needs the device to be rooted.

The following link has the same question but not having any answer:

Accessing localhost of PC from USB connected Android mobile device

Does anybody have aa answer for this?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
  • "The following link has the same question but not having any answer." -> flagged duplicate – sschrass Dec 13 '12 at 09:48
  • possible duplicate of [Accessing localhost of PC from USB connected Android mobile device](http://stackoverflow.com/questions/9887621/accessing-localhost-of-pc-from-usb-connected-android-mobile-device) – curtisk Dec 13 '12 at 12:23
  • You can do that using adb port forwarding method. – AndroidDev Mar 15 '13 at 09:36

1 Answers1

0

I've done this before. Try this:

  • On your Android device enabled USB debugging

    • Android 3.2 or older, you can find the option under Settings > Applications > Development.
    • On Android 4.0 and newer, it's in Settings > Developer options.
  • On your Android device open the browser and visit http://192.168.2.2 (this assumes your web services is on port 80)

Jason
  • 2,341
  • 17
  • 14