1

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?

PearsonArtPhoto
  • 38,970
  • 17
  • 111
  • 142
guness
  • 6,336
  • 7
  • 59
  • 88

1 Answers1

1

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 (

PearsonArtPhoto
  • 38,970
  • 17
  • 111
  • 142
  • I mean, I definitly use internet but, need a more specific answer. If a need to use TCP/IP protocol , which class should, in android sdk, allow me to use it, or if I should use UDP (I do not think but still it is an option.) is there any UDPActivity class. or in application layer, should I use http, or crate my own application protocol? thanks for attention... – guness Mar 29 '12 at 15:23
  • @bluebrain: Please add more details to your original request then. It's sounding like you are needing to communicate with a server, which is far different than what you seem to be requesting... – PearsonArtPhoto Mar 29 '12 at 15:25
  • okay then, assuming I am writing a chess game which has a multiplayer option which works over the internet. (There will be server connection but, http protocol sounded good for server and device communication) Between two android devices, what should I use to implement players movements on chess table? there will be a timer also for time limited rounds also. – guness Mar 29 '12 at 15:32