Petre Popescu
Petre Popescu

Reputation: 2002

Best technology for client-server Android App

I need to make for school an app that runs on Android. Actually there are two apps, a client and a server. Ther server runs on a PC while the clients run on Android devices. I want to know what is the best technology for this. I know RMI and WebServices are not implemented in Android so what are the alternatives (besides actually communicating with sockets in the traditional way). One alternative that I did not look into is REST, but I will need to be able to notify a client once another client has done something, similar to turn base games where Player A notifies Player B that he made his move. Like I said, sockets do the trick, but are little low-level compared to RMI and WebServices and only want to use those as a last resort.

Upvotes: 2

Views: 3135

Answers (2)

Che Jami
Che Jami

Reputation: 5151

For a turn-based game you can take a look at XMPP (e.g. Smack) that is traditionally used for instant messaging. It would also be interesting to create a game using C2DM that is used for push notifications.

You can also look into HTTP streaming which is essentially an unending HTTP response in which player moves are fed into.

Alternatively you can look into binary messaging systems that are more suited for real-time games but still applicable such as RabbitMQ (what's wrong with a smooth turn-based game?).

Upvotes: 2

cdeszaq
cdeszaq

Reputation: 31280

Keep it simple. Use REST and have the clients poll for updates.

Also, if you get to a point down the road where you need to scale, this solution is actually fairly easy to scale because your servers do not need to maintain connections. Since there is no shared state between a particular server and the client (there is shared server between the application and the client), you can easily add more servers to handle the polling and put them behind a load balancer.

You can also add in caching so that the polling just gets the exact same response without causing a re-compute of the response. You would then be able to have the back-end game-state servers update the caches when the game state changes. This would let you poll much more frequently and still have a very flexible, scalable architecture.

Upvotes: 2

Related Questions