简体   繁体   中英

How to get facebook friends birthdays using Hackbook sample in Android

如何使用Android中的Hackbook示例应用程序获取Facebook朋友的生日,仅获取名称和图像.....

Try this query: (using FQL. I have never tested a Graph API equivalent and not sure if it is possible either)

String queryBirthdays = "SELECT uid, name, birthday_date FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me()) AND birthday_date >= '01/03' AND birthday_date <= '06/03' ORDER BY birthday_date ASC";
Bundle bunEvents = new Bundle();
bunEvents.putString("method", "fql.query");
bunEvents.putString("query", queryBirthdays);
String responseEventsQuery = Utility.mFacebook.request(bunEvents);

Then parse the responseEventsQuery . For example, like this:

JSONArray JAEvents = new JSONArray(responseEventsQuery);

for (int i = 0; i < JAEvents.length(); i++) {
    JSONObject JOEvents = JAEvents.getJSONObject(i);
}

Note: You will probably have to play around with these parameters: 01/03 and 06/03 in the query to get the necessary result. Try the query in the Graph API Explorer (In the FQL Query tab)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM