My app uses the SyncAdapter
pattern, holding user credentials using the AccountManager
and a ContentProvider
to store data in a db.
When the account
gets removed I can remove the db using the approach explained in this question. The db gets removed by doing:
boolean deleted = mContext.deleteDatabase(DatabaseHelper.DATABASE_NAME);
This works fine but when I do the login again everything is still there. It feels like the ContentProvider
doesn't know that the db has been removed.
In this answer, inazaruk says:
You need to make sure you've killed the process that hosts ContentProvider that uses that specific database file. And only than delete it.
Killing the process to clear a db doesn't feel right.
Is there a better thing to do?