Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Facebook Friends Age in Android

I am writing an app in which i am fetching list of facebook friends along with their names, profile pics and birthdays, to get that i am using below query:

String query = "SELECT name, birthday, uid, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()) ORDER BY birthday_date ASC";

and i have given these permissions:

String[] facebook_permissions = { "user_photos", "user_birthday",
        "friends_birthday", "friends_photos", "read_stream",
        "offline_access" };

but now i also want to show Age of my facebook friend, and i guess to get that i should use

  age_range

I am also trying to get age of facebook friends by using below query but i am getting null in place of age:

     String query = "SELECT name, birthday, uid, pic_square, age_range FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()) ORDER BY birthday_date ASC";
like image 645
Babu Avatar asked Mar 13 '13 05:03

Babu


1 Answers

Age range is not how old is a person, but, as facebook documentation says:

containing min and max for the age range; Possible age ranges are 13-17, 18-20, and 21+; max is not set if the age is 21+

Why don't you calculate how old friends are using birthday and today dates? This can be done in a very simple way using native Calendar.

I'd recommend you to use new facebook API too.

like image 74
JPMagalhaes Avatar answered Nov 19 '22 11:11

JPMagalhaes