Yes, this can be done using AccountManager and removeAccount .
First get an instance of AccountManager :
AccountManager am = AccountManager.get(this);
Then get a list of all the accounts on the device:
Account[] accounts = am.getAccounts();
Once you have selected the account (s) you want to delete (for this example, we just use the first one), call removeAccount on them:
if (accounts.length > 0) { Account accountToRemove = accounts[0]; am.removeAccount(accountToRemove, null, null); }
You can use the 2nd parameter of the removeAccount method to call back after calling the account (deleting the account is an asynchronous operation).
Joseph Earl
source share