0

我编写了以下代码来获得朋友的生日,但我在生日字段中得到了 null。请告诉我问题出在哪里。

 String fqlQuery = "select uid, name, pic_square, birthday_date from user where uid in (select uid2 from friend where uid1 = me())";
    Bundle params = new Bundle();
    params.putString("q", fqlQuery);

    Session session = Session.getActiveSession();
    AccessToken myToken = AccessToken.createFromExistingAccessToken(session.getAccessToken(), 
            new Date(2013,6,24), new Date(10000000),
            AccessTokenSource.FACEBOOK_APPLICATION_NATIVE, Arrays.asList("friends_birthday"));
    //String token = "CAACEdEose0cBADB1tGwC5OA56v51uNfdMWhe6MliCaJLZBsZBzQdNobdpxyST0Ml10pwJmZBCeZCZC3RcYGSUfDEie9tTZBqMnPmOsJ7lpZBp197u9yZBUpXlDBGOQFHqwNbHwErAVRWXPi6e0WXL5hZBgDREFfZBlwEXGLWn8w407SgZDZD";
    Log.e("AccessToken",myToken.toString());
    params.putString("access_token",myToken.getToken());

    Request request = new Request(session, 
        "/fql", 
        params, 
        HttpMethod.GET, 
        new Request.Callback(){ 
            public void onCompleted(Response response) {
                Log.i("",response.toString());
            }
    });
    Request.executeBatchAsync(request);
4

1 回答 1

0

如果您的某些朋友的生日可用,而有些则不可用,那是因为后者的朋友决定不提供。如果所有朋友都不可用,请确保您有friends_birthday权限

graph.facebook.com/me/permissions?fields=friends_birthday

于 2013-06-23T16:07:10.227 回答