从Android的Facebook的实时更新 [英] facebook realtime updates from android
问题描述
我如何获得Facebook的实时更新与Android。基本上每次用户的好友列表的变化,我需要更新count.I使用了code以下,但我得到的错误信息:
How do I get facebook realtime updates with android .Basically everytime the user's friendlist changes I need to update the count.I used the code below but I get error msg :
{This method must be called with an app access_token.}, isFromCache:false}
我真的AP preciate提前任何help.Thanks。
I really appreciate any help.Thanks in Advance.
code:
Bundle params = new Bundle();
params.putString("object", "user");
params.putString("callback_url", "http://example.com/callback/update.php");
params.putString("fields", "friends");
params.putString("verify_token", "1234");
/* make the API call */
new Request(
session,
"/12345/subscriptions",
params,
HttpMethod.POST,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
注:会话= fb.getsession();
推荐答案
此错误:
这个方法必须被调用的应用程序access_token。
"This method must be called with an app access_token."
是相当直接的。你只需要做的,而不是一个正常的访问令牌(用户令牌),此API调用与应用程序访问令牌。要使用它与您的通话只需添加另一个参数: access_token
键,拨打电话
is quite straight-forward. You just need to make this API call with an App access token, instead of a normal access token (user token). To use it with your call simply add another parameter: access_token
and make the call.
应用程序访问令牌不过, APP_ID | APP_SECRET
,也可以拨打电话(的 REF ) - 。
The App Access token is nothing but, APP_ID|APP_SECRET
, or you can make the call (ref.)-
GET /oauth/access_token?
client_id={app-id}
&client_secret={app-secret}
&grant_type=client_credentials
但要注意,它不建议暴露应用程序的访问令牌
在客户端,因为它就像你的应用程序的密码。
But beware, its not recommended to expose app access token
on the client side, since its like a password of your app.
这篇关于从Android的Facebook的实时更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!