通讯 电脑-电话
我对 android 很陌生,但我已经创建了几个应用程序并发布了, 在安卓市场上。但现在我想为我的应用程序添加升级。 基本上,我的应用程序是一个跟踪软件,目前与短信拦截器一起使用 从而获取数据,如位置、相机、录音……。
所以,我想制作一个桌面应用程序(在您的计算机上),当按下按钮时它可以与 Android 智能手机进行通信。例如,按下“GPS”按钮 - 发送到 Android 手机 - 手机激活 GPS 并获取位置。
现在我的问题是如何建立手机和电脑之间的连接。 我已经尝试过 TCP/IP,但如果我使用他的内部 IP 或外部 IP(使用 www.whatismyip.org),我似乎无法连接到我的手机。
该应用程序正在侦听端口 7890,关闭防火墙,端口转发。做了一切,但我似乎无法与之联系。尽管如此,当我使用 WiFi 网络时,我似乎可以连接。
这可能需要对我的 NAT 做一些事情,但我现在真的不知道该怎么办。
对此的任何帮助将非常感激。
谢谢!
XverhelstX
I'm quite new to android, but I have already created several apps and published,
on the android market. But now I want to add an upgrade to my app.
Basically, my app is a tracking software that currently works with an sms interceptor
and so gets the data, like location, Camera, audio recording, ... .
So, I want to make a desktop application (on your computer) that communicates to the android smartphone when a button is pressed. e.g. Button "GPS" pressed - sends to android phone - phone activates gps and get locations.
Now my question is how I establish the connection between the phone and the pc.
I tried over TCP/IP already, but I cannot seem to connect to my phone if I use his internal ip or his external ip (with www.whatismyip.org).
The app is listening on port 7890, Turned firewall off, port forwarded. Did everything but I cannot seem to connect with it. ALTOUGH I can seem to connect when I am on my WiFi-Network.
This will probably have to do something with my NAT, but I really don't know what to do now.
Any help on this will be really much appreciated.
Thanks!
XverhelstX
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您希望通过移动网络与任意网络上的设备进行通信,您将需要通过某些中央代理网络服务器进行通信。您可以使用某种进行轮询的消息队列:最近我知道有人使用消息队列和发布-订阅类型功能(例如可以在 Redis 中找到)并取得了相当的成功。
If you are looking to do communication to devices on arbitrary networks over the mobile network you will need to do your communication through some central proxy network server. You can use a message queue of some kind that gets polled: recently I know folks who have used message queues and publish-subscribe type functionality (such as can be found in Redis) with reasonable success.
我认为这可能解释了很多。根据您在世界上的位置以及您使用的提供商,某些端口/协议可能会被阻止。使用您自己的 Wi-Fi 网络不受限制,这就是它有效的原因。
您可以尝试使用 HTTP 执行此操作,并让您的设备侦听标准端口(例如 80 或 8080)。然而,仍然不能保证它可以在“公共”网络上运行。
I think this possibly explains a lot. Depending on where you are in the world and which provider you're using, it's likely that certain ports/protocols may be blocked. Using your own wi-fi network is unrestricted which is why it works.
You could try doing this using HTTP and have your device listen on the standard ports (80 or 8080 for example). There's still no guarantee it'll work over a 'public' network however.