简体   繁体   English

从已安装到android设备的Appcelerator移动应用程序本地运行的访问服务器

[英]Access server running locally from Appcelerator mobile app installed to android device

I have a Spring Restful API Server running locally on my machine. 我的机器上本地运行着一个Spring Restful API Server。

I start/stop it as a Tomcat App server via Eclipse's Server's tab. 我通过Eclipse的“服务器”选项卡将其作为Tomcat App服务器启动/停止。

I also have built an Appcelerator app that makes calls to this server. 我还构建了一个Appcelerator应用程序,可以对此服务器进行调用。

When I run my app via the Android Emulator option in Titatium Studio it connects and retreives data fine from my local server. 当我通过Titatium Studio中Android Emulator选项运行应用程序时,它可以连接并检索本地服务器上的数据。 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 . 当我通过usb电缆(在开发人员模式下)将android设备连接至计算机并在Titanium Studio上的Android设备上安装/运行该应用程序时遇到问题。

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 我尝试了本文中提到的选项,但是没有运气: 从工作站外部访问在Eclipse中运行的Web服务器

Is there a way to get around this? 有办法解决这个问题吗?

Thanks 谢谢

Connecting my Samsung Galaxy S2 to local wifi connection (PC using same wifi) fixed the problem. 将我的Samsung Galaxy S2连接到本地wifi连接(使用相同wifi的PC)解决了该问题。 No need for usb cable either of course once it's installed on device. 将USB电缆安装在设备上后,当然也不需要。

Following links may be useful: 以下链接可能有用:
Accessing localhost of PC from USB connected Android mobile device 从USB连接的Android移动设备访问PC的本地主机

How can i access my localhost from my android device? 如何从Android设备访问本地主机?

are you trying to test this by sending the request through the USB cable? 您是否正在尝试通过USB电缆发送请求以对此进行测试? USB's do not use ip address to communicate so i'm not sure exactly how that is suppose to work. USB不使用IP地址进行通讯,因此我不确定该如何工作。

This should work fine if you connect both to a wifi source, I have done this in the past myself. 如果您同时将两者都连接到wifi信号源,则此方法应该可以正常工作,我过去自己也这样做过。 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. 这样做似乎更有意义,因为它打算发布,因为用户将不会通过USB连接到您的服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android应用程序未在移动设备上运行 - Android app not running on mobile device Appcelerator Studio应用未在设备中运行 - Appcelerator Studio app not running in device 在我的情况下,设备访问本地服务器(在MacBook上)上运行的Android应用 - Android app running on device access localhost server (on MacBook) in my case 在物理Android设备上运行Meteor移动应用 - Running Meteor mobile app on physical Android device 无法从Android设备访问计算机上运行的GAE服务器 - Unable to do access GAE server running on computer from Android device Appcelerator Android 6-我的应用程序无法在android 6设备上运行 - Appcelerator Android 6 - My app will not run on android 6 device 如何强制将我的Android应用安装在移动设备上而不是下载 - How to force my android app to be installed in mobile device instead of download 在Android 4.0.4设备上安装appcelerator应用 - installing appcelerator app on android 4.0.4 device 禁止从我的应用程序访问设备中另一个已安装的Android应用程序 - Disable internet access of another installed android app in device from my app 如何从Android应用程序访问本地运行的Django REST项目api? - How to access a locally running django REST project api from android app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM