Deleting a database when deleting an account

My application uses a template SyncAdaptercontaining user credentials using AccountManagerand ContentProviderto store data in db.

When uninstalling, accountI can remove the db using the approach described in this question . Db is removed by doing:

boolean deleted = mContext.deleteDatabase(DatabaseHelper.DATABASE_NAME);

It works great, but when I log in again I still have it. It ContentProviderdoesn't seem to know that db has been deleted.

In this answer , inazaruk says:

You need to make sure that you kill the process that contains the ContentProvider that uses this particular database file. And just delete it.

Killing a process to clear db doesn't seem right.

Is there any better thing to do?

+5
1

, :

Uri, Uri ContentProvider. SQLiteDatabase, , ( Linux , - ).

ContentProvider, , , .

ContentProviders , , , , , , , .

+2

All Articles