Reputation: 5953
I include latest facebook SDK 4.0.1
into the Android Studio project. I want to do basic Graph API call as listed on Graph API reference
/* make the API call */
new Request(
session,
"/me",
null,
HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */
}
}
).executeAsync();
But i am unable to import Request
class, i am getting error Cannot resolve symbol
Request``.
How to resolve this problem? Do i need to import some other library to use Graph API?
Thanks.
Upvotes: 3
Views: 3028
Reputation: 3803
Other than Request
is changed to GraphRequest
, Response
is changed to GraphResponse
and now instead of passing session
, pass AccessToken.getCurrentAccessToken or accessToken
in the constructor. So your query will be like this:
GraphRequestAsyncTask graphRequest = new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{user-id}/",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
Upvotes: 6
Reputation: 15476
As @Gokhan explained, the class is called GraphRequest now.
Facebook SDK 4.x is a major update over 3.x with many changes, you should check out Facebook's upgrading guide.
Upvotes: 0