如何在 Android 2.1 中实现 Beluga 或 WhatsApp 之类的消息系统 [英] How to implement Beluga or WhatsApp like messaging system in Android 2.1

查看:19
本文介绍了如何在 Android 2.1 中实现 Beluga 或 WhatsApp 之类的消息系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的 android 应用程序中开发一个消息应用程序.该消息将类似于 whatsapp 和 beluga.我用谷歌搜索,发现 C2DM Android 2.2 可以向设备发送推送通知.但是,这在 Android 2.1 上不可用.有人知道 whatsapp 如何为 2.1 设备发送通知吗?

I am trying to develop a message app within my android app. The message will be like whatsapp and beluga. I googled it and found C2DM Android 2.2 can send the push notifications to the device. However, this is not available on Android 2.1. Anyone knows how whatsapp send the notifications for 2.1 devices?

推荐答案

对于 Android:Whatsapp 基于 C2DM 构建,当应用程序打开时,它会打开一个 XMPP 连接到他们的服务以立即传递消息.他们还可能使用 MQTT 作为协议来最大限度地减少电池使用量.基本上就是这样.

For Android: Whatsapp is build upon C2DM and when the app opens it opens an XMPP connection to their service to deliver the messages instantly. They also might use MQTT as a protocol to minimize battery usage. That's basically it.

我了解到更多,Facebook 在他们的消息传递应用程序中使用 MQTT.Whatsapp 建立在 XMPP 的基础上,并带有自己的扩展.他们的服务器端运行在 ejabbard(erlang 中的 XMPP 实现)之上.http://www.ejabberd.im/

I learned more, Facebook uses MQTT in their messaging app. Whatsapp is build upon XMPP with their own extensions. Their server side runs on top of ejabbard (XMPP implementation in erlang). http://www.ejabberd.im/

在 2.1 之前的设备上,WhatsApp 可能会在后台保持与 XMPP 服务器的连接,但这对电池寿命并没有好处.

On pre 2.1 devices WhatsApp probably keeps a connection open to their XMPP servers in the background but this is not really good for battery life.

这篇关于如何在 Android 2.1 中实现 Beluga 或 WhatsApp 之类的消息系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆