Question

I already got my phones rooted.

I'm looking for an example or a way to setup ad hoc network programmatically between 2 phones or more.

I'm going to create a multi hop network. Where should I start?

Thanks in advance for any help you are able to provide.

Was it helpful?

Solution

There is quite a lot to this on Android. It is nearly impossible to do generically. If you want to completely control the adhoc network, you basically need to do everything that the framework code does for you in order to start a network. This includes possibly loading the driver, starting the radio, specifying adhoc mode (if it is supported, if not you may have to twiddle configuration files) and setup the network. Setting up the network includes either selecting a random IP address, OR having one phone act as the DHCP server for all the others.

Adhoc sounds like a good idea - implementing is much harder. Either way you can look at a googlecode project I worked on a few years back where I got adhoc networking working on a couple android device.

Android AdHoc Networking

In particular you will want to look at the native code in there and the class StartNetworkActivity on trunk.

Can I ask what you might be trying to do with adhoc networking?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top