我对使用 Facebook 图形 API 感到非常困惑。例如。如果我这样做: https://graph.facebook.com/me/feed ,我得到:
{
"data": [
{
"id": "123456",
"from": {
"name": "Souvik Basu",
"id": "123456"
},
"story": "Souvik Basu shared \"jus'sayin\"'s photo.",
"story_tags": {
"19": [
{
"id": "123456",
"name": "\"jus'sayin\"",
"offset": 19,
"length": 11,
"type": "page"
}
],
"0": [
{
"id": 123456,
"name": "Souvik Basu",
"offset": 0,
"length": 11,
"type": "user"
}
]
但是,我如何在我的 android 代码中获取特定的故事?还有为什么会有第 19 个和第 0 个 sory 标签? 我有标准的 Facebook-Android 代码。
最佳答案
我不明白你的问题到底在哪里...
您使用的是 facebook android sdk ?如果是这样,那么将图形对象获取到您的“android 代码”就非常简单,例如:
Facebook facebook = new Facebook(...);
String response = facebook.request("/me/feed");
JSONObject json = Util.parseJson(response);
JSONArray data = json.getJSONArray("data");
此示例显示正常 API Requests但你也可以使用 Async API Requests .
至于 story_tags 的键,这就是它在 documentation 中所说的:
object containing fields whose names are the indexes to where objects are mentioned in the message field; each field in turn is an array containing an object with id, name, offset, and length fields, where length is the length, within the message field, of the object mentioned
关于android - Android 中的图形 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9652729/