开发者

Live challenge/response between users

开发者 https://www.devze.com 2023-04-04 10:06 出处:网络
I\'m building a game where I\'d like 2 players to fight live between their 2 character. Here is the d开发者_如何学Cesired flow :

I'm building a game where I'd like 2 players to fight live between their 2 character.

Here is the d开发者_如何学Cesired flow :

  • User picks a friend in his friends list and click "fight him"
  • Picked friend receives a notification ( even if the app is in the background )
  • Picked friend accept the challenge
  • Both players fight

The way I want to do it is by using a permanent TCP connection sitting in the background ( service ). I'm afraid of the battery drain it implies. Is there any API/library designed to solve the problem I'm tackling ?


XMPP does that kind of thing with limited battery drain and limited data consumption. http://code.google.com/p/asmack/ is a good library for connecting to an XMPP server


You most probably want to use C2DM for the notifications and XMPP for the actual data transfer.

0

精彩评论

暂无评论...
验证码 换一张
取 消