Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6855993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:49:43+00:00 2026-05-27T01:49:43+00:00

Installed the official FB app for the emulator, and logged in. Generated a working

  • 0

Installed the official FB app for the emulator, and logged in. Generated a working App ID for my application, yet when I trace:

facebook.isSessionValid()

I receive “false”… is this a bug? Any help is appreciated!

public class MainActivity extends ListActivity{

    Facebook facebook = new Facebook("***********");
    String FILENAME = "AndroidSSO_data";
    private SharedPreferences mPrefs;
        .....
    public void add_to_facebook(View view) {
        //add to facebook
        mPrefs = getPreferences(MODE_PRIVATE);
        String access_token = mPrefs.getString("access_token", null);
        long expires = mPrefs.getLong("access_expires", 0);
        if(access_token != null) {
            facebook.setAccessToken(access_token);
        }
        if(expires != 0) {
            facebook.setAccessExpires(expires);
        }

        if(!facebook.isSessionValid()) {

            facebook.authorize(this, new String[] {}, new DialogListener() {
                @Override
                public void onComplete(Bundle values) {
                    Log.d("fb", "onComplete()");
                    SharedPreferences.Editor editor = mPrefs.edit();
                    editor.putString("access_token", facebook.getAccessToken());
                    editor.putLong("access_expires", facebook.getAccessExpires());
                    editor.commit();
                }

                @Override
                public void onFacebookError(FacebookError error) {
                    Log.d("fb", "onFacebookError");
                }

                @Override
                public void onError(DialogError e) {
                    Log.d("fb", "onError()");
                }

                @Override
                public void onCancel() {
                    Log.d("fb", "onCancel");
                }
            });
        }
        //feed dialog
        facebook.dialog(this, "feed", new SampleDialogListener());      
    }

    public class SampleDialogListener extends BaseDialogListener {

        public void onComplete(Bundle values) {
            final String postId = values.getString("post_id");
            if (postId != null) {
                Log.d("Facebook-Example", "Dialog Success! post_id=" + postId);
            } else {
                Log.d("Facebook-Example", "No wall post made");
            }
        }
    }

        ...
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:49:44+00:00Added an answer on May 27, 2026 at 1:49 am

    Looks like I was setting the dialog too early in the process. This remedied the situation:

        @Override
        public void onActivityResult(int requestCode, int resultCode, Intent data) {
            super.onActivityResult(requestCode, resultCode, data);
            facebook.authorizeCallback(requestCode, resultCode, data);
            Log.d("fb", ""+resultCode);
            if(facebook.isSessionValid()){
                facebook.dialog(this, "feed", new SampleDialogListener());
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have integrated the Facebook SDK in my app using the official facebook connect
Its installed and working but I still get 10 warnings. Is this because the
I installed the latest official iphone sdk and now my personal project is getting
I just installed the python-mode in Emacs and it seems to be working well.
I installed Python a while ago from the official python-2.5.4.msi, but I can't remember
I have installed and configured NetBeans 6.7 for c++ according to the official manual:
I know the official way is the registry, but this is kinda timeconsuming. I
I followed the instructions here , and it works fine, when the Facebook App
I re-installed Python 2.7 with the official DMG installer from python.org because I needed
I just installed the Python 2.7.1 on Windows Vista using installer from official site

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.