我正在尝试做什么
Hello and Good Morning Guys,我想创建一个Facebook-Viewer女巫只显示我一个指定的网站,例如这一个:Some Random Facebook Site因为我不知道怎么做,我是看看Facebook API网站,它没有给我任何信息......
问题
因此,你可能会陷入困境,我不知道如何做到这一点。如果你能告诉我以下情况会很棒:
一些额外的信息,我想展示的Facebook网站是公开的(所以我不希望用户必须登录到fb)。
提前为你们准备好了!
最好的问候
狩猎
答案 0 :(得分:1)
以下是我认为您可以尝试的,您需要和开发人员密钥,并且必须创建一个Facebook应用程序。您可以阅读此link,了解这是如何完成的。
完成后,您可以使用FQL
获取页面列表。 This link为您提供有关如何使用Facebook android SDK从Android App进行FQL
查询的信息。
现在您想要的对象是Page。您可以使用适合您需要的参数进行查询。随机化结果并使用Facebook graph API.
答案 1 :(得分:0)
解决问题的方法
我找到了一个解决方案,在我的情况下工作。需要出现的内容:
https://graph.facebook.com/oauth/access_token?type=client_cred&client_id="+APP_ID+"&client_secret="+APP_SECRET
以下是代码:
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.
好消息是你甚至不需要在你的应用程序中使用Facebook SDK。 最诚挚的问候
狩猎