if (session == null){
Log.i("dd", "session value in winLoose 1");
session = new Session(this);
Session.setActiveSession(session);
} else if (session.isOpened())
{
Session.setActiveSession(session);
}
Request.Callback callback = new Request.Callback()
{
public void onCompleted(Response response)
{
FacebookRequestError error = response.getError();
if (error != null) Log.d("fb","error"); else Log.d("fb","Success"); } };
Request request = Request.newUploadPhotoRequest(session, bitmap, callback);
request.executeAsync();
我的会话已打开当我运行上面的代码&当我试图通过此代码将我的屏幕截图发布到FB。然后,此代码Toast me (#200)
需要扩展权限publish_actions
答案 0 :(得分:1)
我找到了答案。我的应用程序未获得publish_actions的许可。所以我的FB应用程序需要对Facebook进行审核,以便他们允许发布pub_actions的权限。 非常感谢您的努力
答案 1 :(得分:0)
private final String[] PERMISSIONS = new String[] {
"publish_actions", "email", "user_birthday","read_stream", "user_photos"
};
在登录期间传递此权限。
答案 2 :(得分:0)
使用findViewById
FacebookSdk.sdkInitialize(getApplicationContext());
CallbackManager callbackManager = CallbackManager.Factory.create();
LoginButton loginButton = (LoginButton) this.findViewById(R.id.login_button);
loginButton.setReadPermissions("publish_actions", "email", "user_birthday"); //Add extra permissions here