0

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

Verhelst
  • 1,492
  • 2
  • 22
  • 46

2 Answers2

1

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.

Femi
  • 64,273
  • 8
  • 118
  • 148
  • Could you please give some more information about this? That would be really much appreciated - XverhelstX – Verhelst Jun 14 '11 at 19:34
  • Sure: you can see a brief demo of the publish/subscribe usage at http://blog.abourget.net/2011/3/31/new-and-hot-part-6-redis-publish-and-subscribe/, and I know that the Jedis client at https://github.com/xetorthio/jedis works on Android. – Femi Jun 14 '11 at 20:34
0

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.

Squonk
  • 48,735
  • 19
  • 103
  • 135
  • So I would just need to send the package to port 80 or 8080 and listen on that port? – Verhelst Jun 14 '11 at 19:22
  • Or how should I handle with this? What would be the best solution for my application? - Thanks - XverhelstX @MisterSquonk – Verhelst Jun 14 '11 at 19:35