i'm developing an android application with accounts, sync and content provider. adding an account works, syncing also and some data is saved in the content provider.
now, when the user deletes the account using the settings, syncing stops, but the data stays in the content provider.
i'd like to delete it, but i don't know how to catch the event of account deletion.
There is AccountManager.addOnAccountsUpdatedListener()
, i've tried to add it to the sync service, but the sync service is started only for the sync and then stopped. so whenever the account gets deleted while there is no sync, it can't get caught.
is there a best practice on how to handle private data when an account gets deleted?