如何在Android中获取当月Facebook好友生日列表



我正在编写一个Facebook Android应用程序,我想在其中显示Facebook好友列表当月生日。我使用以下代码来获取:-

    public static void requestFriends(FacebookRequest facebookRequest) 
    {
    Log.d(LOG_TAG, "requestFriends(" + ")");
    Calendar c = Calendar.getInstance();
    int month = c.get(Calendar.MONTH) + 1;
    String query = "select name, birthday, uid, pic_square from user where uid in (select uid2 from friend where uid1=me())AND birthday_date >= '" + month+ "/01' AND birthday_date <= '" + month+ "/31' ORDER BY birthday_date ASC";
    Bundle params = new Bundle();
    params.putString("method", "fql.query");
    params.putString("query", query);
    FacebookUtility.asyncRunner.request(null, params, 
    new FacebookRequestListener(FacebookRequestListener.FRIENDS, facebookRequest));
}

每当我运行我的应用程序时,我都不会得到任何数据,然而我的三个朋友的生日是二月,但我没有得到这些生日。

我的Logcat说:-

02-18 16:14:39.918: I/Choreographer(978): Skipped 78 frames!  The application may be doing too much work on its main thread.
02-18 16:14:39.918: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:39.928: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.078: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.078: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.108: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.108: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.148: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.148: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.188: I/FacebookUtility(978): LoginListener onComplete Bundle[{access_token=AAAF2qLBdroMBAGZBbot29pzoZAKbOWJkK5GDIxUCz8g0IFnhCO9yclfHevmvZCFJ4ObQSH0aY055x6ILPbFgSuqVjl7EaWYo4MKbLb8BgZDZD, expires_in=5164038, code=AQDqK2l6gUcRILPfFl87Z290PhZQfDhmQValGvFU77bqbnM91wOtcI3MMIL-Usvs49XDVlnbnjZ_mNiPn9a6-CC11rY2Z-aUTb0yz8S6IophHApQstnfnK9mCJNI_BwGsYyyvv9pZ3gbaGSC5IHpryzatZyZGnBlvo5CZXg6h_drmgd6Gfe6e4akqXWJsnSsXUe4ion-jUysuniGNu3Bnbp7}]
02-18 16:14:40.188: D/Facebook Friends(978): onLoginResultReceived(0)
02-18 16:14:40.218: D/FacebookUtility(978): requestFriends()
02-18 16:14:40.239: I/Choreographer(978): Skipped 83 frames!  The application may be doing too much work on its main thread.
02-18 16:14:40.239: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.248: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.248: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.278: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.278: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.278: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.428: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.428: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0

您需要更改以下代码,希望它能正常工作

Calender cal = Calendar.getInstance();
cal.get(Calender.YEAR);
String yr = cal.gettime();
String query = "select name, birthday, uid, pic_square from user where uid in (select uid2 from friend where uid1=me())AND birthday_date like '"+ yr+ month+"%' ORDER BY birthday_date ASC";

最新更新