Question

If you were working on a turn based game like Chess with android phone clients and a server

IE: Player A submits their turn, server computes logic, sends results to players A and B, AND notifies player B that it is their turn.

What ways are there to contact an android client via the server without maintaining persistent connections?

I am using simple TCP sockets to send string data and curious if there is a way to do this reliably since I've heard android IP addresses are in constant flux

Était-ce utile?

La solution

Google Cloud Messaging GCM. It's free. It's unlimited. It's maintained by Google. And it's already installed on user's phones.

That being said, the ideal way now is to use Google Play Services and have people login with their Google+ accounts. Watch the last Google I/O 2013 session on Google Play Services. The demo went wrong during the general keynote, but it works fine otherwise.

Google Play Services takes care of all the networking issues for you (and also falls back to local wifi if users are on the same network). The price you have to pay is that you must force your users to use Google+ if they want that multiplayer functionality.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top