What should I use to have continues connection which I will send and get data in discrete times?

StackOverflow https://stackoverflow.com/questions/9928240

Question

I will write an android program. for simplicity, it will need a connection similar to multiplayer games. I will need to connect two or more devices in a way that they will send and get short data ocassionally ie. once in 20 seconds. Which class should I use, or what type of protocol should I implement?

Was it helpful?

Solution

Well, there are a number of methods to send data. A bit of this depends on the device, and what specs they have, but in general, here's the methods, along with the pros and cons.

Bluetooth- This will work within a room. Most cell phones have Bluetooth as well. It requires the devices sync up externally, and thus might be a bit tricky, but it is doable.

Wifi/internet- Most devices have an internet connection. The devices could communicate with a server, who would share data between devices, or directly. Android 4.0 allows for direct communication via WiFi, but in general, I would only recommend this for 4.0 devices.

Near Field Communication- New to Android 4.0 (Very few phones have 4.0). This will only work for very short distances (

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