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 4611728
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:18:25+00:00 2026-05-22T01:18:25+00:00

I want to clear the application’s data when a user manually removes an account

  • 0

I want to clear the application’s data when a user manually removes an account from the Accounts & sync section in the settings app.

I have my own implementation of AbstractAccountAuthenticator but there is no method to hook in the remove account process. Any hints?

  • 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-22T01:18:26+00:00Added an answer on May 22, 2026 at 1:18 am

    I’ve been pondering on the same problem and here’s the “solution” I decided upon. It’s not what I’d call the “correct” solution but it’s the best I believe you can manage with the current API.

    In my implementation of the AbstractAccountAuthenticator class, I’ve overriden the getAccountRemovalAllowed function as follows:

    @Override
    public Bundle getAccountRemovalAllowed(
            AccountAuthenticatorResponse response, Account account)
            throws NetworkErrorException {
        Bundle result = super.getAccountRemovalAllowed(response, account);
    
        if (result != null && result.containsKey(AccountManager.KEY_BOOLEAN_RESULT)
                && !result.containsKey(AccountManager.KEY_INTENT)) {
            final boolean removalAllowed = result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT);
    
            if (removalAllowed) {
                // Do my removal stuff here
            }
        }
    
        return result;
    }
    

    There is a tiny chance that removal could fail AFTER you return from getAccountRemovalAllowed but it’s negligible (IMHO).

    As MisterSquonk suggested there is an Intent that you could listen for (ACCOUNTS_CHANGED_INTENT) but, unfortunately, it’s broadcast when an account changes, and not just when an account is deleted.

    I don’t understand why this isn’t part of the SDK but maybe we’ve both missed something obvious! For now, I’m sticking with this approach as I need to delete some database tables of my own on account deletion.

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to clear data through coding for my application. Right now I am
I want application to clear cookie for every user on first site load after
I am storing data in application scope. I want to clear this data after
I want to clear a element from a vector using the erase method. But
i want to clear the fields of my form after the user has inserted
I want to run a shell command in Terminal, then clear the console, from
I want to set the preferences of my application in the settings application. I
I have a simple test application where I want to have a clear button
I want to cache custom data in an ASP.NET application. I am putting lots
in my application im exporting gridview data to excel sheet now i want save

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.