Reputation: 7825
What I'm trying to do
Hello and good Morning Guys, I'd like to create an Facebook-Viewer witch only show's me one specified Site for example this one here: Some Random Facebook Site Because I didn't know how to do this, I was taking a look at the Facebook API site, which gave me no Information....
Question
So as you probably pinnend, I have no clue how to do this. It would be great if you can tell me following:
Some additional Information, the Facebook-Site I'd like to show is public (so I don't want that the user has to log in into fb).
Thx for you anwsers in advance!
Best Regards
safari
Upvotes: 0
Views: 195
Reputation: 7825
Solution for the Problem
I figured out a solution witch works in my case. What needs to be present:
https://graph.facebook.com/oauth/access_token?type=client_cred&client_id="+APP_ID+"&client_secret="+APP_SECRET
Here's the Code for it:
private static final String ACCESS_TOKEN_QUERY = "https://graph.facebook.com/oauth/access_token?type=client_cred&client_id="+APP_ID+"&client_secret="+APP_SECRET;
private static final String FEED_URL = "https://graph.facebook.com/"+PAGE_ID+"/feed?";
private static String accesstoken = "";
private static String jsonresponse = "";
Context context;
String line = null;
final ArrayList<HashMap<String, String>> videolist = new ArrayList<HashMap<String, String>>();
//Get AccessToken
try{
URL url = new URL(ACCESS_TOKEN_QUERY);
URLConnection conn = url.openConnection();
StringBuilder sb = new StringBuilder();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
//read d response till d end
while ((line = rd.readLine()) != null) {
sb.append(line + "\n");
}
accesstoken = sb.toString();
Log.v("log_tag", "Append String " + accesstoken);
} catch (Exception e) {
Log.e("log_tag", "Error converting result " + e.toString());
}
//Get JSON
try{
URL url = new URL(FEED_URL+accesstoken);
URLConnection conn = url.openConnection();
StringBuilder sb = new StringBuilder();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line = rd.readLine()) != null) {
sb.append(line + "\n");
}
jsonresponse = sb.toString();
Log.v("log_tag", "Append String " + jsonresponse);
} catch (Exception e) {
Log.e("log_tag", "Error converting result " + e.toString());
}
//Here you got the jsonresponse now, with which you can go on.
The good thing is you don't even need to have the Facebook SDK in your App. Best Regards
safari
Upvotes: 0
Reputation: 7435
Here is what I think you can try and you would need and developer key and would have to create an Facebook application that. You can read this link to see how thats done.
Once you have it then you can use FQL
to get the list of pages. This link give you info about how to make FQL
query from android App using the Facebook android SDK.
Now the object that you want is Page. You can make query using what ever parameter suits your need. randomize the result and show the page using Facebook graph API.
Upvotes: 1