Ryo
Ryo

Reputation: 11

Facebook Graph Api v 2.4

Facebook released a new version of its well-known graph api, and I think that the documentation provided by https://developers.facebook.com/ is quiet confusing. I'm actually working on an app that will need a facebook connection; therefore I would like to have some proper, let's say more straight forward, help or guidance. I already tried a couple of things but it seems that I'm trying it the wrong way.

AccessToken accessToken = intent.getExtras().getParcelable("aaaa");
        new GraphRequest(accessToken,"/{id,birthday",null,
                HttpMethod.GET,
                new GraphRequest.Callback() {
                    public void onCompleted(GraphResponse response) {
                        Log.d("aaaa",response.toString());
                    }
                }
        ).executeAsync();

I hope that someone will help me, and provide me some advices.

Upvotes: 1

Views: 1001

Answers (2)

andyrandy
andyrandy

Reputation: 74014

Try this instead:

AccessToken accessToken = intent.getExtras().getParcelable("aaaa");
        new GraphRequest(accessToken,"/me?fields=id,birthday",null,
                HttpMethod.GET,
                new GraphRequest.Callback() {
                    public void onCompleted(GraphResponse response) {
                        Log.d("aaaa",response.toString());
                    }
                }
        ).executeAsync();

Upvotes: 1

Umair M
Umair M

Reputation: 10750

Well ! Best solution that i have found so far is that:

  1. Go to Graph API Explorer and request for /v2.4/me/ or v2.4/userIdForWhichYouWantToAccessData
  2. Start adding fields from left pane which you want to get.
  3. When you are done, submit the query and then copy the query string and use it with new GraphRequest().

I hope its helpful :)

Upvotes: 0

Related Questions