Post to user facebook wall not working when Facebook app is installed on device/emulator

后端 未结 3 638
情书的邮戳
情书的邮戳 2021-01-14 03:09

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 e

3条回答
  •  野的像风
    2021-01-14 03:31

    private static final String[] PERMISSIONS =
            new String[] {"publish_stream", "read_stream", "offline_access"};  
    
    
    
    
    @Override
    public void onClick(View v)
    {
        if (v == facebookPostButton)
        {
            mAsyncRunner    = new AsyncFacebookRunner(mFacebook);
                                       mAsyncRunner.request(mFacebook.logout(getApplicationContext()), new LogoutListener());
                            mFacebook.authorize(FacebookImplement.this, PERMISSIONS, new AuthorizeListener());
        }
    }
    
    
    
    public class AuthorizeListener extends BaseDialogListener {
    
            public void onComplete(Bundle values) {
    
               Bundle params = new Bundle();
               params.putString("message"," Message");
           params.putString("description", "Wall Posting Description");        
            mAsyncRunner.request("me/feed", params, "POST",
                    new UploadListener());         
    
            }
    

    }

    public class UploadListener extends BaseRequestListener {
    
            public void onComplete(final String response) {
                  mAsyncRunner.request(mFacebook.logout(getApplicationContext()), new LogoutListener());
    }
    

    }

     public class LogoutListener extends BaseRequestListener {
    
    
            public void onComplete(final String response) {         
    
    
    
            }
        }
    

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

提交回复
热议问题