views:

1375

answers:

3

I'm wondering if, with the G1, it's possible to force the network traffic to pass through the Wifi or through the Cell GSM network. I need to force an application to connect through the tower network to get some login information. Is this possible? Anyone have any ideas as to how this would be possible? I'm trying to accomplish this inside an app with the Android SDK (Sorry I wasn't more clear about that originally)

+1  A: 

I'm assuming that you can simultaneously communicate via either channel, so at some level there aught to be separate network interfaces for each. Since android is based on linux, you could try using ifconfig or a library function to determine which interfaces are available, and which does what. If you can accomplish this, there should be a way to explicitly send/recv via the channel you want (i.e. by communicating via the ip for that interface).

Sorry I couldn't be more specific.

Dana the Sane
Sadly, I'm trying to do this through the SDK, which, I don't think, lets me manipulate the raw network interfaces
haseman
A: 

What you are looking for on the G1 is to set the default route. You may do so using the linux utility aptly named route, the default route is going to be to ip 0.0.0.0 and then the gateway.

Not sure if you can do this per application, but you can do it system wide!

X-Istence
+2  A: 

It turns out to be possible using the WifiManager object to disable and then re-enable the connection. You can block it for the duration of a network call if you want to force data over the cell network. I imagine there is a similar GSM network manager out there which will do a similar task for the cell connection.

haseman