在我的应用程序中,我有Facebook登录功能,然后获取用户的好友列表 和我的fb应用程序是在2014年4月30日之前创建的,这就是为什么我能够根据版本v1.0和sdk 3.14获取朋友列表但我得到一些问题... 我没有得到朋友列表只有那些使用fb app的朋友.. 所以我的问题是关于通过权限
String[] FB_Permission_Friends = {"email", "public_profile", "user_address",
"user_birthday", "user_mobile_phone",
"user_hometown", "user_location",
"friends_hometown", "friends_location",
"friends_checkins", "read_friendlists",
"friends_birthday", "friends_online_presence",
"user_online_presence", "user_status"};
我的代码..
public void FbLogin() {
FacebookData.Session = createSession();
Settings.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
if (!FacebookData.Session.isOpened()) {
FacebookData.Session.openForRead(new Session.OpenRequest(this).setCallback(callback).setPermissions(FB_Permission_Friends));
}
}
private Session createSession() {
Session activeSession = Session.getActiveSession();
if (activeSession == null || activeSession.getState().isClosed()) {
activeSession = new Session.Builder(SocialNetworkActivity.this).setApplicationId(Constant.Fb_APP_ID).build();
Session.setActiveSession(activeSession);
}
return activeSession;
}
Session.StatusCallback callback = new Session.StatusCallback() {
public void call(Session session, SessionState state, Exception exception) {
if (exception != null) {
new AlertDialog.Builder(SocialNetworkActivity.this)
.setTitle("Login failed")
.setMessage(exception.getMessage())
.setPositiveButton("OK", null)
.show();
FacebookData.Session = createSession();
}
}
};