Search code examples
androidandroid-c2dm

How is C2DM properly used for a turn-based android game?


Got a question regarding C2DM and how it is properly used for a turn-based game (like chess). Should I create a subscription for each player, that is used to communicate with that player? Or should I create a subscription for the "match" that the players currently involved in subscribes to?


Solution

  • C2DM involves 2 servers, the first one are google servers, where users register the first time they user uses the application or everytime that Google refreshes their userID. When a user receives the ID then the user sends the ID to your server. With those Id you can then send messages. The main goal of C2DM is to provide fresh data to a user by awaking their application.

    You only need one google account. The account that you will create for your App. If i was you. I would use the C2DM only to notify a user that someone wants to play with him, once the user has agreed to play I would implement my own protocol, and stop using C2DM.

    Every user should create an entrance into your database. Since the id refers to a phone not to a match.

    Note that c2dm only provides 1Kbyte information per message.

    I hope it is more clear now.