我正在尝试使用我的应用程序内的Facebook API分享帖子,我在Facebook Developer上创建了一个帐户,我将应用程序ID放在应用程序中,登录过程工作正常,如果我分享了开发者Facebook的帖子帐户,每件事都很好。但是,当我尝试使用任何其他Facebook帐户分享时,我什么都没有共享。 我正在使用Facebook SDK 3.5及以下版本的共享代码:
/**
* Post message with image
*
* @param imageURl
*/
public void postStatusMessage( byte [] imageURl ) {
if ( checkPermissions( Session.getActiveSession() ) ) {
final CustomProgressDialog progress = new CustomProgressDialog( FBActivity.this ) ;
progress.show() ;
// Filling the needed data for the share
Bundle parameters = new Bundle() ;
parameters.putString( "message" , shareText.getText().toString() ) ; // message
parameters.putString( "description" , name ) ;// description
parameters.putString( "link" , linkUrl ) ;// link if available
parameters.putByteArray( "picture" , imageURl ) ;// byte array for the image so it can be shared as image not as link
Request.Callback callback = new Request.Callback() {
public void onCompleted( Response response ) {
if ( response.getError() == null ) {
// Share post was done succesfully
Toast.makeText( FBActivity.this , getString( R.string.statusUpdateSucc ) , Toast.LENGTH_LONG ).show() ;
onlineActionID = ( String ) response.getGraphObject().getProperty( "id" ) ;
shareSuccesfuly = true ;
} else {
// Fail in share
Toast.makeText( FBActivity.this , "" + getString( R.string.statusUpdateFail ) , Toast.LENGTH_LONG ).show() ;
}
// Dismiss progress dialog
if ( progress.isShowing() )
progress.dismiss() ;
// if share was done sucessfully , navigate back to the previvos page
if ( shareSuccesfuly ) {
finish() ;
}// end if.
else {
finish() ;
}// end else().
}
} ;
// Request should have the me/photos tag so we can share photos in the user profile
Request request = new Request( Session.getActiveSession() , "me/photos" , parameters , HttpMethod.POST , callback ) ;
request.executeAsync() ;
} else {
requestPermissions() ;
}
}
答案 0 :(得分:1)