fluttercommunity / flutter_contacts

Contacts Service - A Flutter plugin to retrieve and manage contacts on Android and iOS devices. Maintainer: @lukasgit
https://pub.dev/packages/contacts_service
MIT License
153 stars 69 forks source link

Cannot Update Contact Details that don't exist #79

Closed kmccmk9 closed 5 years ago

kmccmk9 commented 5 years ago

Hello,

I've encountered this problem, where if I have a contact Jane Doe, who does not have an address (for example). I update their Contact object to include an address and I call the updateContact method. There are no errors but if I go and check the contact, they will not have an address. I actually forked this repo to begin working on this problem. What I've descovered is using the update query only works if there is already an existing field for this contact. So to make it easier on developers I just do a drop and re-insert of most of the data. See my code thus far here (so far working): https://github.com/kmccmk9/flutter_contacts/blob/updateContact/android/src/main/java/flutter/plugins/contactsservice/contactsservice/ContactsServicePlugin.java

lukasgit commented 5 years ago

@trinqk thoughts?

trinqk commented 5 years ago

If the contact was created by the Native Android contacts app, it seems the update query only works if the field already exists.

@kmccmk9 Your code seems to be working on my end too. Could you create a PR?

trinqk commented 5 years ago

This should have been fixed in PR #82. I'm going to close this for now. Let me know if you still have issues with this.