获取移动应用程序(Android 或 iOS)的 Facebook Stream 更新
我想使用 Facebook API 获取在 Android 或 iOS 上运行的移动应用程序的流更新。我做了一些研究,发现我可以直接从移动设备使用 Facebook API 调用(图形 API 或 FQL)(不一定要通过中间服务器)。
但是,我想在后台获取 Facebook 更新,即使应用程序没有运行。
因此,由于我是移动开发新手,我的问题是:
如果应用程序未运行(用户未显式打开),我可以使用应用程序的代码获取应用程序的更新,还是应该使用中间服务器它将向应用程序发送通知?
我是否应该在中间有一个服务器来在应用程序不活动时发送通知。
我只需要了解,如果我想在移动应用程序不活动时接收通知,除了移动应用程序之外,我是否还需要开发一个访问 Facebook 的服务器。
I want to use the Facebook API for getting stream updates to my mobile application running on Android or iOS. I did some research and I can see that I can use the Facebook API calls (graph API or FQL) straight from the mobile device (not necessarily go through an intermediate server).
But, I want to get Facebook updates in the background, even if the application is not running.
So, since I am new to mobile development, my questions are:
If the application is not running (not explicitly opened by the user) can I get updates to the application using the application's code, or should I use an intermediate server that would send the notifications to the application?
Should I have a server in the middle to send notifications when the application is not active.
I simply need to understand if I need to develop a server accessing Facebook besides the mobile application if I want to receive notifications when the mobile app is not active.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不一定需要服务器。
最基本的实现可以从 facebook sdk 检索 access_token,添加 <您的权限请求的 href="http://developers.facebook.com/docs/reference/api/permissions/" rel="nofollow">offline_access 选项。
然后,您可以使用 android alarmmanager 定期“唤醒”您的应用程序。广播接收器可以执行您想要从 facebook api 进行的任何更新,并且它不一定需要向用户显示任何内容。
A server is not necessarily required.
The most basic implementation of this could retrieve an access_token from facebook sdk adding the offline_access option to your permissions request.
Then you can use an android alarmmanager to "wake up" your app periodically. The broadcast receiver can perform whatever updates you want to make from the facebook api and it doesn't necessarily ever have to show anything to the user.
对于 Android 使用后台服务,这些服务专门设计为即使在用户关闭您的应用程序后也在后台运行。
http://developer.android.com/reference/android/app/Service.html
For Android use a background service, these are specifically designed to run in the background even after a user closes your app.
http://developer.android.com/reference/android/app/Service.html