朋友在android的生日

时间:2013-06-23 07:47:30

标签: android facebook

我写了下面的代码来得到朋友的生日,但我在生日字段中得到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);

1 个答案:

答案 0 :(得分:0)

如果你的朋友有一些生日可用,有些则不是,因为后面的朋友决定不提供它。如果所有朋友都不可用,请确保您拥有friends_birthday权限

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