0

I've got this issue;

ContentProvider (contacts) - no such column: metadata_dirty

My phone is stock, not rooted, HTC 10.

I'm trying to solve it.

Option 1 seems to be to root phone, install sqlite3, and run an alter table query.

Preferring not to root my phone, I was going for option 2 (I'm guessing possible); take template app and modify to run alter table query, once.

And this is where I am stuck - how to get to the RAW contacts database without using the handlers that don't seem to offer any ALTER TABLE functionality?

Community
  • 1
  • 1
martin_
  • 52
  • 3

1 Answers1

0

how to get to the RAW contacts database without using the handlers that don't seem to offer any ALTER TABLE functionality?

You would need to root your device. The contacts database is not lying around where any app can get to it, for obvious privacy reasons. Instead, the contacts database is part of the internal storage dedicated to the Contacts app, and your app has no direct access to that database.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thank for the feedback on this one. I guessed that a backup app broke my contacts list schema on a restore. However phone set up went, configure, recover, then upgrade, so this shouldn't have happened. If the backup app can't write directly to the database, then how on earth did the phone get into this state? – martin_ Apr 14 '17 at 22:39
  • @user3800535: Beats me. Your workaround is to provide an explicit column list. Somehow, the `ContactContract` provider is out of sync with its database structure. Its default column list includes this mythical `metadata_dirty` column. If you simply avoid that column (and any other missing ones), your code should work. – CommonsWare Apr 14 '17 at 22:44