Sha*_*zal 3 java android facebook-graph-api facebook-android-sdk android-studio
我将最新的facebook SDK 4.0.1
包含在Android Studio项目中.我想进行Graph API参考中列出的基本Graph API调用
/* make the API call */
new Request(
session,
"/me",
null,
HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
Run Code Online (Sandbox Code Playgroud)
但我无法导入Request
类,我收到错误Cannot resolve symbol
请求``.
如何解决这个问题?我是否需要导入其他库来使用Graph API?
谢谢.
除了Request
更改为GraphRequest
,Response
更改为GraphResponse
现在而不是传递session
,传递AccessToken.getCurrentAccessToken or accessToken
构造函数.所以你的查询将是这样的:
GraphRequestAsyncTask graphRequest = new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{user-id}/",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2706 次 |
最近记录: |