2

I am currently developing a multiplayer card game, using simple servlets with the Android device sending JSON back and forth. I am currently confused on how to tell all other clients that a certain player has submitted a card, so that they all can update their UI.

What are the options for me to do so? I am currently thinking of several options:

  1. Fetch from a MOVE_TABLE from database every x ms. (with specific room IDs and live room sessions).
  2. Let the servlet send a certain 'broadcast' to the respected clients in the room each time a certain player do something, so that the other clients don't have to do a GET or POST every x ms. (although I don't know how to do this, it's just my thinking).

Can anybody help me? Or maybe suggest me a better solution? Thanks a lot for your help :)

nic
  • 2,125
  • 1
  • 18
  • 33

1 Answers1

0

Will using this type of solution work for you? http://android-developers.blogspot.com/2010/05/android-cloud-to-device-messaging.html

I found it at this question if you want some more info: Does Android support near real time push notification?

If this would cause a massive architecture change to send the move as a notification, then may I suggest just using the push notification as a hint for the game to perform a new MOVE_TABLE query or whatever you need to do to get the new move.

Community
  • 1
  • 1
Justin Breitfeller
  • 13,737
  • 4
  • 39
  • 47
  • from the link: It uses existing connections for Google services. This requires the users to sign into their Google account on Android. I cannot let my user sign in to their Google account just to play..I use my own LOGIN_TABLE..or should I pull this from the Accounts and Sync menu.. I don't think this option is quite favourable for me.. Thanks for your help anyway :) – nic Oct 05 '11 at 00:13
  • however, judging from some of the push technologies available now, I think I have to use C2DM T_T as I am running this on Windows..Deacon project seems promising but it seems it drains battery life – nic Oct 05 '11 at 09:12
  • Yea sorry. I'm not too familiar with a simple way to get people to use their Google account. I would imagine its not a huge burden to the user if they are already logged in to get your app through the marketplace? – Justin Breitfeller Oct 05 '11 at 14:33
  • I have found a better solution. I have to use a socket-server, i.e. SmartFoxServer to suit my needs better. C2DM is not suitable for frequent message pushing, C2DM also does not guarantee the order the messages being pushed. – nic Nov 01 '11 at 06:46