Wi-fi P2P. Inform all peers available of some event

后端 未结 2 768
日久生厌
日久生厌 2021-01-01 02:45

The problem: I\'m making an offline-multiplayer android game, where people can create or join a room and play together via Wi-fi. Consider the situation when a user creates

2条回答
  •  难免孤独
    2021-01-01 03:46

    Basically, your design as I see it has very simple solution for the design with Wifi Direct.

    Basically when creating "a room" that other can join, simply create a group, then do add local service to advertise the room.

    note that you might need to start peer discovery, in order to be visible with your local service, at least my experience has been that, you do need to be active somehow, or you are not discoverable.

    Then with clients, simply do service discovery and once you find the "room" simply connect to the it.

    Then as the connections are initiated by the clients, the acceptance dialogs should be shown in Group owners side.

提交回复
热议问题