wifi chat between two or more android devices

22,662

Solution 1

You can be able to chat between two android devices in Android Version 4.0.There is an API called 'Wifi P2P'.More information can be had from here:

http://developer.android.com/reference/android/net/wifi/p2p/package-summary.html

Solution 2

If you are thinking about connecting devices that are under the same WiFi AP/router and without setting up any server, then I would suggest you to consider using UDP multicast which has been available since API level 1:

http://developer.android.com/reference/java/net/MulticastSocket.html

UDP does not guarantee data delivery (could be lost), so I would use UDP multicast for device discovery, and open up a TCP connection for data that requires guaranteed delivery. TCP listening port can be advertised via UDP multicast so that everyone can connect with each other over TCP. (There may be 3rd party tool that does this low level stuff for you.)

Share:
22,662
Mamun Sardar
Author by

Mamun Sardar

I am a full-stack java web developer with 5+ of professional experience. I've completed my graduation back in 2013 on Software Engineering. Since then I've worked on many enterprise level applications design and development with java ecosystem and frameworks. I like to write code, learn new things, play games. I care about basic human rights.

Updated on October 16, 2020

Comments

  • Mamun Sardar
    Mamun Sardar over 3 years

    I want to develop an chat application to chat between two or more android devices using wifi network.The application should be able to send or receive strings from each other. I have an experience of using Bluetooth network between pc and android. Can any give me any suggestion or right direction. Thanks in advance.