的iOS / Android的实时新闻提要实施 [英] iOS/Android realtime news feed implementation

查看:170
本文介绍了的iOS / Android的实时新闻提要实施的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 是它安全地说,建立一个实时新闻饲料类型的应用程序使用轮询比插座做得更好?我计划建设用于移动设备的新闻提要类型的应用程序,并计划与插座这样做,但我开始认为这可以更好地构建一个RESTful应用程序,而不是和刚做客户端上的短轮询间隔获得新的更新。怎么会有其他人那里实现实时的移动应用程序?

Based off this is it safe to say that building a real-time news feed type application is better done using polling than with sockets? I'm planning on building a news feed type app for mobile devices and was planning on doing it with sockets but I'm starting to think that it may be better to build a RESTful app instead and just do short-interval polling on the client to get new updates. How have others out there implemented "real-time" mobile apps?

推荐答案

在Android的,的 GCM 为任何实时通知你最好的选择。这不能简单或更快的notifs得到真正的时候,如果你有一台服务器比可以推动notifs。

In Android, GCM is your best bet for any real-time notifications. It couldn't be simpler or faster to get the real time notifs, if you have a server than can push the notifs.

在iOS上,你最好写一个轮询机制。我能想到的最好的例子是iOS的新的Facebook应用程序。这似乎轮询每隔30秒左右,以检查是否有新的数据。如果有新的数据,并在用户点击新故事棒,将获得的新的数据并显示它。

On iOS, your better off writing a polling mechanism. The best example I can think of is the new Facebook app for iOS. It seems to poll every 30s or so to check for new data. If there is new data, and the user clicks the new stories bar, it will get the new data and display it.

一个简单的请求和定时器的工作,但也有一个叫长轮询,在这种情况下效果很好。这将限制对电池电量的消耗。

A simple request and timer would work, but there is also a technique called Long Polling that works well in these situations. This will limit the drain on the battery.

因此​​,在短期,由于在推通知苹果的限制,你将不得不解决它。然而,在一般情况下,推notifs是要走的路,所有的事情考虑。

So in short, because of Apples restrictions on Push-Notifications, you will have to work around it. However, in general, push notifs are the way to go, all things considered.

这篇关于的iOS / Android的实时新闻提要实施的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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