我已通過我的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;
}
}
請附上您用於將照片發佈到Facebook的代碼。 –
@Salman Ayub,好吧,它現在被添加 –
您使用Facebook登錄窗口小部件嗎?對於認證?我認爲你錯過了一些權限。 –