Facebook SDK for Android: how to get the user's gender

后端 未结 3 576
无人共我
无人共我 2021-01-17 04:03

I suppose its either getProperty(\"sex\") or (\"gender\") or user.asMap().get(\"sex\") or (\"gender\") ? also, what kind

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-17 04:14

    no seperate permission for this this values you can get gender like this And see THIS

       private String UserInfoDisplay(GraphUser user) {    
    
            StringBuilder userInfo = new StringBuilder("");              
            String Name =  user.getName();
            String Id =   user.getId();
            String lastname =    user.getLastName();
            String firstname =  user.getFirstName();
            String getUsername =  user.getUsername();             
    
            String get_gender = (String) user.getProperty("gender");
    
    
            String image_url = "http://graph.facebook.com/"+user.getId()+"/picture?type=square";        
    
            Log.i("User information == >", Name +Id + lastname+ 
                    firstname + image_url + get_gender +  getUsername + "usermail"+User_mail  );
    
            text.setText(Name + "  mail = " +User_mail);
    
            return userInfo.toString();
        }
    

提交回复
热议问题