Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Facebook SDK authorize methods shows dialog every time
    primarykey
    data
    text
    <p>I'm writing an Android application that should upload photos to Facebook.</p> <p>Everything works just fine except one thing. When I called the Facebook.authorize() method for the first time the Facebook dialog was shown with requested permissions and 'Allow'/'Don't Allow' buttons. That was OK. But when I run my app for the secong time I've got the same dialog, but with message that my application allowed already and suggestion to press OK button.</p> <p>Is there a way to avoid this second dialog? Should I skip the authorize method in some conditions?</p> <p>I tried to call the Facebook.isSessionValid() method before authorize method, but this did not help.</p> <p>Here is my simplified code:</p> <pre><code> mFacebook = new Facebook(APPLICATION_ID); mFacebookAsync = new AsyncFacebookRunner(mFacebook); if (mFacebook.isSessionValid()) { uploadPictureFile(); } else { mFacebook.authorize(this, new String[] {"publish_stream"}, new Facebook.DialogListener() { @Override public void onFacebookError(FacebookError e) { Toast.makeText(PhotoFeederFacebookSendActivity.this, "Facebook error: " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show(); finishWithResultCode(RESULT_CANCELED); } @Override public void onError(DialogError e) { Toast.makeText(PhotoFeederFacebookSendActivity.this, "Facebook dialog error: " + e.getLocalizedMessage(), Toast.LENGTH_LONG).show(); finishWithResultCode(RESULT_CANCELED); } @Override public void onComplete(Bundle values) { uploadPictureFile(); } @Override public void onCancel() {Toast.makeText(PhotoFeederFacebookSendActivity.this, "Facebook authorization cancelled.", Toast.LENGTH_LONG).show(); finishWithResultCode(RESULT_CANCELED); } }); } </code></pre> <p>And here is my onActivityResult method:</p> <pre><code> @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { mFacebook.authorizeCallback(requestCode, resultCode, data); } </code></pre> <p>Any help appreciated. Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload