Personally, I suggest using the PubNub lib, http://www.pubnub.com/docs/java/android/android-sdk.html, which IHO is more robust than GCM.
When a game is created with x number of players, each player would programmically be subscribe to a pubnub channel.
When player X does something in the game, that action would be instantly published in the channel, and all the players subscribed to that channel would instantly get notification
( in the code) of that action, so then you could take that indication and visible notify the awaiting player its her turn.
Here's a snippet of using the Pubnub id lib on the client side, to receiving incoming msgs on a particular chan:
public void Startpubnub(String channel) {
Toast.makeText(this, channelName+"TransportLine activated...", Toast.LENGTH_LONG).show();
Log.i("PUBNUB", channelName+"TransportLine activated...");
try {
pubnub.subscribe(new String[] {channel}, new Callback() {
public void connectCallback(String channel) {
notifyUser("CONNECT on channel:" + channel);
}
public void disconnectCallback(String channel) {
notifyUser("DISCONNECT on channel:" + channel);
}
public void reconnectCallback(String channel) {
notifyUser("RECONNECT on channel:" + channel);
}
@Override
public void successCallback(String channel, Object message) {
Log.i("tag","broadcast is sent!");
notifyUser(channel + " " + message.toString());
Log.i("afterBroadcastisSent", message.toString());
try {
Message m = Message.obtain();
Bundle b = new Bundle();
b.putString("message", message.toString());
m.setData(b);
mMessageHandler.sendMessage(m);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void errorCallback(String channel, Object message) {
notifyUser(channel + " " + message.toString());
}
});
} catch (PubnubException e) {
}
Then subscribe to that chan on your backend aswell, http://www.pubnub.com/docs/java/javase/javase-sdk.html,
https://github.com/pubnub/python,
then pub a msg back to the chan based on the incoming msg.
You can even communicate with GCM over PubNub.
And if you plan on supporting devices especially international based devices, that doesn't have google play services install because of licensing issues, PubNub is the ultimate quick and fast real time push/pull mechanism. PubNub is essentially that Socket communications that @Ashish described above but outside of Google infrastructure.