1

I am able to update image in contact from my app and its visible in contacts but as soon as google sync occurs it deletes the image from contact.

My code:

ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
    .withValue(ContactsContract.Data.RAW_CONTACT_ID, lRawContactId)
    .withValue(ContactsContract.Data.IS_PRIMARY, 1)
    .withValue(ContactsContract.Data.IS_SUPER_PRIMARY, 1)
    .withValue(ContactsContract.Data.MIMETYPE, 
               ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE)
    .withValue(ContactsContract.CommonDataKinds.Photo.PHOTO,
               getImageByteArray(bitmap))
    .build());
Andreas Linden
  • 12,489
  • 7
  • 51
  • 67
Rohit
  • 810
  • 2
  • 9
  • 34
  • i think after updating the image you need to send one message to google server that image has been updated – Preethi Rao May 13 '16 at 12:45
  • i don't think so as i am updating phone number, name and image together. All fields are updating expect image. – Rohit May 13 '16 at 13:15

1 Answers1

1

That's probably because you only set the thumbnail of the photo. Please see my response in Changing contact's image to a large photo via PHOTO_FILE_ID in Android to see how you should add or update a contact photo.

Community
  • 1
  • 1
Marten
  • 3,802
  • 1
  • 17
  • 26