How to delete the User accounts (Gmail, Facebook) Info and data saved in Android phone programmatic-ally?

二次信任 提交于 2019-12-04 22:17:31

you can do this way,i tried on gmail its working for me and its become clear the gmail apss and no history of log in etc you will just log out but dont know what do you mean by delete?

AccountManager am = AccountManager.get(this);
Account[] accounts = am.getAccounts();
if (accounts.length > 0) {
    Account accountToRemove = accounts[0];
    am.removeAccount(accountToRemove, null, null);
}

Add the following permission as well

 <uses-permission android:name="android.permission.ACCOUNT_MANAGER"/>
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!