简体   繁体   English

如何使用 facebook-android-sdk 获取 facebook 页面的 stream

[英]How to get facebook page's stream with facebook-android-sdk

I followed steps here: https://developers.facebook.com/docs/guides/mobile/#android but I really don't get how use Graph API to get a Page's stream (only news) for Android. I followed steps here: https://developers.facebook.com/docs/guides/mobile/#android but I really don't get how use Graph API to get a Page's stream (only news) for Android.

Someone can make me an example?有人可以给我举个例子吗? I cannot also find a real good example online searching with Google...我也找不到一个真正的用谷歌在线搜索的好例子......

There's a good Graph API explorer here , getting a page info is simple as using GET request with the page id.这里有一个很好的 Graph API explorer,获取页面信息很简单,就像使用带有页面 id 的 GET 请求一样。

https://graph.facebook.com/<PAGE_ID>    

So you can use the Simple Sample found here所以你可以使用这里找到的简单示例

//Page id for Bristol (my hometown) but could use something like 'cocacola'
String PAGE_ID="108700782494847"
mBristolPageButton.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
  //get the request aysn and process JSON response with the Listener
  mAsyncRunner.request(PAGE_ID, new MyPageRequestListener());
}
});

To get the feed/news from a page put /feed on the end [However you may require a auth_token to get news stream]要从页面获取提要/新闻,请将 /feed 放在末尾 [但是您可能需要 auth_token 才能获取新闻流]

https://graph.facebook.com/<PAGE_ID>/feed

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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