I'm trying to share post using Facebook APIs inside my application , i created an account on Facebook Developer and i put the app id inside the application , the login process is working fine and if i shared a post from the developer Facebook account , every thing is fine . But when i try to share using any other Facebook account i got nothing shared . I'm using Facebook SDK 3.5 and below are the sharing code:
/**
* 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() ;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.