Wednesday, April 28, 2010

Connecting Internet to the Droid

Connecting with Android to a service on the Internet over EDGE or 3G (or what ever) is no rocket science.

Now, connecting from the Internet to a service on an Android device is a whole other story!

This could depend on mobile providers, but it's safe to assume that most do not assign public IP addresses to your phones for them to access the Internet, but instead you get a private IP on mobile provider's local network, which is then routed to the Internet trough their routers.

What that means, there is no way to connect directly to your Android device if it's on mobile Internet. There are a couple of ways to go around that, but all require a third party component.

The method chosen for this project is to link the Android device (acting as a server) and a computer (acting as a client) in to a Virtual Private Network.

Easiest way (with least components) to achieve that is to have a VPN support in a router which connects to the Internet with with a public IP address (DSL, Cable, ...). Hence the post below.

Once the VPN service is established (for now PPTP was used for being the simplest and widely supported with options for encryptions if needed), the connected devices can once again communicate between themselves as if they were on the same network, which means accessing opened ports on an Android device with a service from a client far far away.

Why would this be useful to go trough so much trouble? Tracking "real time" telemetry from the plane, like position, altitude, speed, status, images from the on board camera.

Saying "real time" since because all the routing there is a lag between information and reception of that information (once a connection is established latency way about 200ms to 700ms in this test, to infinity ms if reception is bad):

Driving in a car with HTC G1 running a tracking service and a laptop connected to mobile Internet running a client and displaying data on Google Earth.

The whole rout was: HTC G1 -> mobile provider -> broadband provider -> home router -> broadband provider -> mobile provider -> HP laptop.

No comments:

Post a Comment