androidandroid-networkingandroid-nsd

Connect Android devices


I would like to know if there is any way to connect few android phones together? For example, one phone acts as the host and the rest connect to it?

I'm planning to make a game, but I need some connection like this (without Internet connection).

Thank you.


Solution

  • What you're asking for is done by Android Network Service Discovery (NSD). Via the framework you can connect devices without Internet connection (over Wi-Fi/Wi-Fi Direct).

    Conceptually it looks as follows:

    1. One device register a service (host);
    2. Other devices discover the service and connect to the host (clients).

    Here is a good sample app which may help you start.