6

I am using a content observer to track changes in contacts, and depending on that I check added/updated contacts through

ContactsContract.Contacts.CONTENT_URI 

with

ContactsContract.Contacts.CONTACT_LAST_UPDATED_TIMESTAMP

and deleted contacts with

ContactsContract.DeletedContacts.CONTENT_URI 

with

ContactsContract.DeletedContacts.CONTACT_DELETED_TIMESTAMP.

Everything is working fine on my huawei device (Added, updated or deleted), but on samsung devices, the added and updated are getting catched and tracked but a problem existed with the delete.

The delete has 2 cases:

  • If the contact is deleted from multiple selection (main contacts page) it is being catched in content observer but not in the ContactsContract.DeletedContacts.CONTENT_URI query.

  • If the contact is deleted in the details of the contact page, it is being catched in content observer and in the ContactsContract.DeletedContacts.CONTENT_URI query.

The problem only occured with me (till now) on 2 samsung devices but not on a huawei device.

If someone had a similiar problem before, please advice.

Emma
  • 27,428
  • 11
  • 44
  • 69
JKOU
  • 255
  • 2
  • 14
  • are you running your query from within your content observer? if so, try adding a delay for ~5 seconds. maybe you're just querying the table before the DB had a chance to log those deletions. – marmor Nov 24 '19 at 13:28
  • @marmor no i am not querying the table from the observer, i am actually waiting for the user to reopen the app either from background or from scratch to do the operations, i will test delete, wait sometime and then check if it is inserted. – JKOU Nov 25 '19 at 07:41
  • @marmor i tried deleting and waiting for nearly 10 seconds, same issue, it did not show the deleted contact – JKOU Nov 25 '19 at 07:44
  • Are you sure this problem cannot be recreated on a non-Samsung device? – Taslim Oseni Nov 28 '19 at 12:35
  • @TaslimOseni I tested it on huawei and samsung devices, it only happened on the samsung ones – JKOU Nov 28 '19 at 13:58

0 Answers0