Unable to get a facebook page's feed onto my app

前端 未结 2 1587
野的像风
野的像风 2021-02-02 04:13

I want my app to just display the posts published by a facebook page without any authentication. Here is the code:

public class Main extends Activity {

@Overrid         


        
相关标签:
2条回答
  • 2021-02-02 04:52

    There is actually a way to get a page public feed without user permission!

    Solution

    1. Get the page Facebook Profile Id: the simplest way is to query the Graph API http://graph.facebook.com/{YourPageUsername} . e.g. for oStream Android App https://graph.facebook.com/oStreamApp will return Facebook Profile Id 289781571139242

    2. Request the RSS of the Facebook page feed: Make an http request to https://www.facebook.com/feeds/page.php?format=rss20&id={yourAppId} e.g. For oStream Android App the Public https://www.facebook.com/feeds/page.php?format=rss20&id=289781571139242

    An Android implementation will simply be:

    1. Make an http request to http://graph.facebook.com/{YourPageUsername}
    2. Parse the content and get the YourPageId
    3. Make an http request to https://www.facebook.com/feeds/page.php?format=rss20&id={yourAppId}
    4. Parse the content
    5. Display the content as you wish

    Side note This question is not very much about Android but just with Facebook API.

    0 讨论(0)
  • 2021-02-02 05:06

    I've done it with the access token. There's a tool in facebook developpers "Tool/Access Token Tool" You'll get an access token called "app token" that you can use like this : https://graph.facebook.com/"Your Facebook ID"/feed?access_token="Your app token";

    Then you'll get the json object of your feed and you'll be able to do whatever you want using JSON parsing methods.

    Your app token will not move until somebody change the password or try to get another "app secret id" in your app management page on Facebook. Enjoy!

    0 讨论(0)
提交回复
热议问题