通过Android上传的照片未在Facebook上获得批准
我已通过我的Android应用成功上传照片到Facebook,该应用存在于为我的应用创建的相册中,但照片需要由用户手动批准,并且Facebook表示:通过Android上传的照片未在Facebook上获得批准
Would you like to add these photos to your album?
The photos below were uploaded from another application, you'll need to approve them.
它看起来像这样在Facebook上:
顺便说一句,我已经添加了user_photos
许可。这里是上传代码:
public void uploadToFB(Uri photo){
Session session = Session.getActiveSession();
Bundle bundle = new Bundle();
bundle.putString("url", "http://6269-9001.zippykid.netdna-cdn.com/wp-content/uploads/2013/09/Cute-Dog-Wallpaper-Pictures.jpg");
new Request(
session,
"/me/photos",
bundle,
HttpMethod.POST,
new Request.Callback() {
@Override
public void onCompleted(Response response) {
dialog.dismiss();
}
}
).executeAsync();
}
在MainActivity:
@Override
protected void onResumeFragments() {
super.onResumeFragments();
Session session = Session.getActiveSession();
if (session != null && session.isOpened()) {
startActivity(new Intent(this, LoggedMainActivity.class));
} else {
showLoginFragment();
}
}
private void showLoginFragment(){
LoginFragment login=new LoginFragment();
getSupportFragmentManager()
.beginTransaction()
.add(android.R.id.content, login)
.commit();
}
这是LoginFragment:
public class LoginFragment extends Fragment {
private LoginButton authButton;
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.login_fragment,
container, false);
authButton=(LoginButton)view.findViewById(R.id.login_button);
authButton.setReadPermissions(Arrays.asList("user_photos","publish_stream","read_stream"));
return view;
}
}
你缺少publish_stream
权限在您Facebook Login Widget
下面是演示如何添加权限:
/*LoginButton authButton = (LoginButton) findViewById(R.id.YOUR_ID);
authButton.setReadPermissions(Arrays.asList("user_photos"));
authButton.setPublishPermissions(Arrays.asList("publish_stream","read_stream"));*/
这些权限只需添加到您的登录窗,一切都应该正常工作。
编辑:Setting up Read and Publish Permissions together :
Get Read and Publish Permissions in one request
我希望这有助于。
嗨,我在添加上面的权限时出错,错误是:无法将发布或管理权限(publish_stream)传递给读取授权请求。任何提示:) –
是的,我预计:)你有一些冲突的权限。请发布您的Facebook登录Widget的初始化代码。 –
非常感谢,我已经添加了。 –
请附上您用于将照片发布到Facebook的代码。 –
@Salman Ayub,好吧,它现在被添加 –
您使用Facebook登录窗口小部件吗?对于认证?我认为你错过了一些权限。 –