简体   繁体   中英

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?

  1. User A sends message to User B, that is, it sends a message to your application server.
  2. You app server receives a message from A to B. It sends a C2DM notification to B telling that there is new data.
  3. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM