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

  • Home
  • SEARCH
  • 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 8257007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:03:44+00:00 2026-06-08T02:03:44+00:00

I am using facebook api in my app. Its working fine i can login

  • 0

I am using facebook api in my app. Its working fine i can login and post on wall. But i couldn’t delete the login information.

This is the code

   public boolean saveCredentials(Facebook facebook) {
        Editor editor = getApplicationContext().getSharedPreferences(KEY, Context.MODE_PRIVATE).edit();
        editor.putString(TOKEN, facebook.getAccessToken());
        editor.putLong(EXPIRES, facebook.getAccessExpires());
        return editor.commit();
    }

    public boolean restoreCredentials(Facebook facebook) {
        SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences(KEY, Context.MODE_PRIVATE);
        facebook.setAccessToken(sharedPreferences.getString(TOKEN, null));
        facebook.setAccessExpires(sharedPreferences.getLong(EXPIRES, 0));
        return facebook.isSessionValid();
    }

    public boolean removeCredentials()
    {
        SharedPreferences prefs = getApplicationContext().getSharedPreferences(KEY, Context.MODE_PRIVATE);

            facebook.setAccessToken(prefs.getString("", null));
        facebook.setAccessExpires(prefs.getLong("", 0));
        Editor editor = prefs.edit(); 
        editor.clear();
        editor.commit(); 
        return true; 
    }

The Shared preferences details hasn’t deleted by calling removeCredentials() method. It just post the message on facebook wall.

I just want to delete the saved details and if again user requests to posting the message on wall then i need to popup the login screen.

Thanks for your Help guys

  • 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-06-08T02:03:46+00:00Added an answer on June 8, 2026 at 2:03 am

    Refer below link

    https://stackoverflow.com/a/3687333/1441666

    SharedPreferences.Editor.remove() followed by a commit()
    

    or

    SharedPreferences preferences = getSharedPreferences("Mypref", 0);
    preferences.edit().remove("text").commit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get friends count via my account using Facebook API. Its working
Using the Facebook API, you can get back the post ID of a Facebook
I am using Facebook-java-api to integrate the Facebook app in java web app(Struts), i
I'm developing an HTML app that integrates Facebook Graph API using Javascript SDK. Facebook
I created an APP on Facebook and using graph API explorer, I selected my
I am creating an iphone app using Facebook api. Here I'm using the following
I'm using Facebook graph API for my iPhone app to get a list of
Question: How to delete an application request using the facebook-actionscript-api? I am trying to
Here I am creating an iPhone app using facebook api. I have loaded the
I'm working on an app using facebook & oauth. The app lives inside a

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.