I have an Android
application that uses Accounts
to synchronize
data with my server. Yesterday I noticed that, if I click Clear Data
in Settings->Apps->My App, the application data is removed but the user account isn't. This leads to consistency problems in my server, since suddenly the user's data is restarted without receiving a restart message.
Is there any way to delete the Account
when the user clicks Clear Data
? Or at least capture the event to be able to send a message to my server.
Thanks!
There is two ways for you to do it..
1.Not allowing the user to clear the data..this can be done by simply mentioning the..
android:manageSpaceActivity=".ActivityOfYourChoice"
in your manifest under application tag..
2.You can deleting the accounts.it can be done using the AccountManager
and the removeAccount
method.
First get an instance of the AccountManager:
AccountManager am = AccountManager.get(this);
Then get a list of all accounts on the device:
Account[] accounts = am.getAccounts();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With