Live challenge/response between users
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.
精彩评论