Communication Pc-Phone
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 record开发者_StackOverflow中文版ing, ... .
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
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.
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.
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.
精彩评论