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

前端 未结 2 1598
野的像风
野的像风 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条回答
  •  猫巷女王i
    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.

提交回复
热议问题