Skip to content Skip to sidebar Skip to footer

Post To User Facebook Wall Not Working When Facebook App Is Installed On Device/emulator

I've built an activity that uses this implementation (see the accepted answer) to post a status update on a user's facebook wall. It works with no problem if the emulator/phone doe

Solution 1:

I have found a workaround but it is not the best so far.

facebook.authorize(activity, PERMISSIONS, Facebook.FORCE_DIALOG_AUTH, 
                newLoginDialogListener());

This will force that your app does not use the SSO if official facebook app is installed on the device. But there must be a better solution because there are apps out there which use sso with the official facebook app.

Solution 2:

It is because when you logged in the facebook account then your login session is created in the device. You have to logout from the facebook after doing your task.

Solution 3:

privatestatic final String[] PERMISSIONS =
        new String[] {"publish_stream", "read_stream", "offline_access"};  




@Override
publicvoidonClick(View v)
{
    if (v == facebookPostButton)
    {
        mAsyncRunner    = new AsyncFacebookRunner(mFacebook);
                                   mAsyncRunner.request(mFacebook.logout(getApplicationContext()), new LogoutListener());
                        mFacebook.authorize(FacebookImplement.this, PERMISSIONS, new AuthorizeListener());
    }
}



publicclassAuthorizeListenerextendsBaseDialogListener {

        publicvoidonComplete(Bundle values) {

           Bundle params = new Bundle();
           params.putString("message"," Message");
       params.putString("description", "Wall Posting Description");        
        mAsyncRunner.request("me/feed", params, "POST",
                new UploadListener());         

        }

}

publicclassUploadListenerextendsBaseRequestListener {

        publicvoidonComplete(final String response) {
              mAsyncRunner.request(mFacebook.logout(getApplicationContext()), newLogoutListener());
}

}

publicclassLogoutListenerextendsBaseRequestListener {


        publicvoidonComplete(final String response) {         



        }
    }

May be this code helps you. If there is any problem then ask without any issue.

Post a Comment for "Post To User Facebook Wall Not Working When Facebook App Is Installed On Device/emulator"