C2DM Push chat application
Currenlty I am trying to develop a simple chat application for Android. I want to create something that works like WhatsApp. Because it should be realtime, I think C2DM is the best way to send a notification when a user sends a message to another user.
Because I have read that C2DM is build for noticiations only, and not for messages I have to find a way to deliver those messages to that other contact.
Now, I have a application server, that can send C2DM notifications. But what's the best and the most energy saving way to send and receive the 'textmessages'?
I have read about polling, but it's not that energy saving I think. I have read something about 'XMPP', but how can I combine that with C2DM?
- User A sends message to User B, that is, it sends a message to your application server.
- You app server receives a message from A to B. It sends a C2DM notification to B telling that there is new data.
- User B receives the C2DM notification of new data, connects to your app server and retrieves the message from User A.
This mechanism only pushes data, there is no polling.