新闻Feed从Facebook墙壁到一个Android应用程序 [英] news feed from facebook wall to a android app

查看:164
本文介绍了新闻Feed从Facebook墙壁到一个Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将Facebook上的最后一篇文章发布到Android应用中?我想制作一些像RSS阅读器来获取应用程序的一些信息。



更好地解释 -



我在Facebook上有一个关于一个足球俱乐部的页面,在那里我发布了关于新闻,游戏等的几个信息。现在我已经做了一个Android应用程序,我的问题是,我可以导入到Android应用程序的帖子?

解决方案

当然可以。首先,如果您是Facebook的新功能集成 - 阅读Android集成的基础知识,登录/授权调用其API等(根本不复杂)。



Facebook提供了许多使用 访问令牌



根据您的要求,您只需使用API: / PAGE_ID / feed 页面访问令牌获取您的页面的Feed。可以使用API​​获取页面access_token: me / accounts?fields = access_token,name Demo )在用户授权/登录后。



您可以在此测试此API: 图形API资源管理器 ,使用已存在的默认令牌。






更聪明的方式



(不使用Facebook API)



由于您的要求仅涉及后端进程,因此可以使用此方法。


  1. 首先,获取长寿命页面访问令牌(永远不会过期)。详细步骤 <强>此处 。您可以使用此处的短命令。


  2. 使用此令牌并作出 \GET 请求:


    https://graph.facebook.com/PAGE_ID/feed? access_token = TOKEN_FROM_STEP_1


    (您可以在浏览器中查看结果)


这是它!


There is any way to get the last post's made on a facebook wall into a Android app? I want to make some like a RSS reader to get some information on the app.

To explain better-

I have a page on facebook about one football club and there I post several information about news, games etc. Now I have made an android app and my question is whether I can import the post into the android application?

解决方案

Of course, you can. First of all, if you are new to facebook integration- read the basics of the android integration, login/authorization calling its APIs etc. (not complex at all).

Facebook provides many APIs (for different functions) that uses the access token.

Based on your requirement, you just need to use the API: /PAGE_ID/feed with the page access token to get the feeds of your page. The page access_token can be obtained with the API: me/accounts?fields=access_token,name (Demo) after the user authorization/login.

You can test this API here: Graph API Explorer, using the default token already present there.


Smarter way

(Without using the facebook API)

Since your requirement involves only back-end processes, you can use this method.

  1. First of all, get the Long-lived page access token (that never expires). Detailed steps here. You can use the short-lived token from here.

  2. Use this token and make a \GET request to :

    https://graph.facebook.com/PAGE_ID/feed?access_token=TOKEN_FROM_STEP_1

    (You can check the result in the browser)

This is it!

这篇关于新闻Feed从Facebook墙壁到一个Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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