0

I have a Spring Restful API Server running locally on my machine.

I start/stop it as a Tomcat App server via Eclipse's Server's tab.

I also have built an Appcelerator app that makes calls to this server.

When I run my app via the Android Emulator option in Titatium Studio it connects and retreives data fine from my local server. The request is:

var TRANSACTIONS_URL = 'http://myipaddress:8080/PurchaseAPIServer/api/purchase';

I encounter a problem when I connect my android device to machine via a usb cable (in developer mode) and install/run the app on Android Device with Titanium Studio.

My locally running server is never been hit.

I have tried options mentioned in this article but had no luck: Accessing webserver running within Eclipse from outside the workstation

Is there a way to get around this?

Thanks

Community
  • 1
  • 1
Thomas Buckley
  • 5,836
  • 19
  • 62
  • 110

2 Answers2

0

Connecting my Samsung Galaxy S2 to local wifi connection (PC using same wifi) fixed the problem. No need for usb cable either of course once it's installed on device.

Following links may be useful:
Accessing localhost of PC from USB connected Android mobile device

How can i access my localhost from my android device?

Community
  • 1
  • 1
Thomas Buckley
  • 5,836
  • 19
  • 62
  • 110
0

are you trying to test this by sending the request through the USB cable? USB's do not use ip address to communicate so i'm not sure exactly how that is suppose to work.

This should work fine if you connect both to a wifi source, I have done this in the past myself. it also makes more sense as if this is intended to be published as an app users will not be connecting to your server via a USB.

Simon McLoughlin
  • 8,293
  • 5
  • 32
  • 56
  • I mistakenly though Titantium Studio would do some magic and allow it to work this way when connecting via USB. I was clearly wrong and found the answer as you can see above :) – Thomas Buckley May 24 '12 at 10:11