jignesh.world
jignesh.world

Reputation: 1446

How to get Birthdate, Email and Profile Picture of facebook friends in Android

How to Retrieve Name, Birthdate and Profile Picture, E-mail Address of my facebook friend in Android using facebook SDK ??

Any way using Graph API or Returned JSON Object.. help me in this matter..

I know you are thinking this question has been asked...but thrust me you can't able to get fully satisfaction from anywhere...

But I had gone through almost all the question and related links of all of them as well searched on facebook sdk documentation but I had not get any clues which leads me to success...

I had already tried on getting JSON object as well as using Graph API.

I know using both the way we can get the things like birthdate and profile picture of friends...

It doesn't allow me to upload my code here.. but I think my problem was related to get permission from facebook..

Try to solve this problem and give me some code snippet for Birthday date, Profile picture , Email... etc.. things of my facebook friend using facebook sdk...

Where i stuck... Permission Not Granted see below Logcat...

06-28 10:03:43.542: W/com.facebook.Session(3650): Should not pass a read permission (user_likes) to a request for publish or manage authorization

06-28 10:03:43.542: W/com.facebook.Session(3650): Should not pass a read permission (email) to a request for publish or manage authorization

06-28 10:03:43.542: W/com.facebook.Session(3650): Should not pass a read permission (user_birthday) to a request for publish or manage authorization

06-28 10:03:43.552: W/com.facebook.Session(3650): Should not pass a read permission (link) to a request for publish or manage authorization

06-28 10:03:43.552: W/com.facebook.Session(3650): Should not pass a read permission (friends_birthday) to a request for publish or manage authorization

06-28 10:03:43.552: W/com.facebook.Session(3650): Should not pass a read permission (friends_photos) to a request for publish or manage authorization

06-28 10:03:43.552: W/com.facebook.Session(3650): Should not pass a read permission (friends_about_me) to a request for publish or manage authorization

06-28 10:03:43.552: W/com.facebook.Session(3650): Should not pass a read permission (friends_link) to a request for publish or manage authorization

It will help you to solve my problem.... Your all suggestion is Welcome.

I am finding solution last few days please give me some useful idea.

Upvotes: 3

Views: 3424

Answers (2)

jignesh.world
jignesh.world

Reputation: 1446

I had put my solution below it may be helpful to others

Authorize Facebook using your permissions

facebook.authorize(context, new String[] { "publish_stream",
                "friends_birthday" }, Facebook.FORCE_DIALOG_AUTH,
                new DialogListener() }

after that in onComplete method get and store Access token and now run this FQL in AsyncRunner you will get response as Json

String query = "SELECT uid,name,username,birthday_date,pic_big FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) ";
        // String query = "SELECT name FROM user WHERE uid = me()";
        Bundle params = new Bundle();
        params.putString("method", "fql.query");
        params.putString("query", query);

        mAsyncRunner.request(params, new RequestListener()}

Now Parse it json and use in your app..

If still you have any problem feel free to ask.

Upvotes: 1

MasterScrat
MasterScrat

Reputation: 7366

You should take a look at the example Facebook apps:

https://developers.facebook.com/samples/

Upvotes: 1

Related Questions