Android访问Facebook好友列表

时间:2014-07-30 09:15:53

标签: android facebook

我正在尝试使用AsyncFacebookRunner检索Facebook好友列表:

mAsyncRunner = new AsyncFacebookRunner(mFacebook);

private void makeFriendsRequest() {
    this.graph_or_fql = "graph";
    Bundle var1 = new Bundle();
    var1.putString("fields", "name, picture, birthday, gender");
    mAsyncRunner.request("me/friends", var1, (AsyncFacebookRunner.RequestListener)(new    MainActivity.FriendsRequestListener()));
}

String[] permissions = new String[]{"offline_access","user_friends","public_profile" ,"publish_stream", "xmpp_login", "user_birthday", "friends_birthday", "user_about_me", "friends_about_me"};

public void onClick(View var1) {
    if(LoginButton.this.mFb.isSessionValid()) {
        SessionEvents.onLogoutBegin();
        (new AsyncFacebookRunner(LoginButton.this.mFb)).logout(LoginButton.this.getContext(), LoginButton.this.new LogoutRequestListener((LoginButton.LogoutRequestListener)null));         
    } else {
        LoginButton.this.mFb.authorize(LoginButton.this.mActivity, LoginButton.this.mPermissions, LoginButton.this.mActivityCode, LoginButton.this.new LoginDialogListener((LoginButton.LoginDialogListener)null));
    }
}

我显示回复Log.e("friendlist", var1);

但我在logcat上得到以下内容:

  

{friendlist {data:[],"摘要":" total_count":232}}

public class FriendsRequestListener extends BaseRequestListener {

          public FriendsRequestListener() {}

          public void onComplete(String var1, Object var2) {

             frndsList=var1;
             Log.e("friendlist", var1);


             MainActivity.this.mHandler.post(new Runnable() {
                public void run() {
                   try {
                       MainActivity.this.dialog = new Dialog(MainActivity.this);
                       MainActivity.this.dialog.requestWindowFeature(1);
                       MainActivity.this.dialog.setContentView(R.layout.syncfriendsdialogue);
                       MainActivity.this.dialog.setCancelable(true);
                       MainActivity.this.dialog.show();
                      (MainActivity.this.new StartingApp()).execute(new Void[0]);
                   } catch (Exception var2) {
                      var2.printStackTrace();
                   }
                }
             });
          }

0 个答案:

没有答案