我正在使用 Facebook SDK for android 作为外部库。我可以通过 facebook 登录。但是当我想共享图像并且应用程序没有通过 facebook 登录时,我正在尝试登录,但在这种情况下我会遇到异常和获取访问令牌为空。请帮助
W/com.facebook.Session(15670):不应将读取权限(电子邮件)传递给发布或管理授权请求 W/com.facebook.Session(15670):不应将读取权限(read_friendlists)传递给请求发布或管理授权
请找到代码:
String[] permissions = { "email",
"user_birthday",
"publish_stream",
"user_checkins",
"friends_checkins",
"read_friendlists",
"publish_checkins",
"publish_actions" };
final static int AUTHORIZE_ACTIVITY_RESULT_CODE = 0;
facebook = new Facebook(APP_ID);
mAsyncRunner = new AsyncFacebookRunner(facebook);
facebook.authorize(getActivity(), permissions, AUTHORIZE_ACTIVITY_RESULT_CODE,
new DialogListener() {
public void onComplete(Bundle values) {
System.err.println("Inside oncomplete");
//getProfileInformation();
}
public void onFacebookError(FacebookError error) {
System.err.println(error.toString()+ "Facebook.authorize Error: ");
try {
dialog.dismiss();
} catch (Exception e) {
// TODO: handle exception
}
dialog=null;
}
public void onError(DialogError e) {
System.err.println(e.toString()+ "Facebook.authorize DialogError: ");
Log.d(this.getClass().getName(),
"Facebook.authorize DialogError: "
+ e.toString());
try {
dialog.dismiss();
} catch (Exception e1) {
// TODO: handle exception
}
dialog=null;
}
public void onCancel() {
System.err.println("Facebook authorization canceled");
Log.d(this.getClass().getName(),
"Facebook authorization canceled");
try {
dialog.dismiss();
} catch (Exception e) {
// TODO: handle exception
}
dialog=null;
}
});
}
}
});