Question for Contact Writer API

Hi all,

I've finally gotten my Android device and I can now implement the
contact.save() functionality.  I've run into what I think is a real problem
which is best described by illustrating the situation.

Let's say I do a navigator.service.contacts.find(["displayName,
phoneNumbers"], success, fail, obj).  Then I get the first contact in the
returned array and delete all the phone numbers from the contact.  Then if I
do a contact.save() I'm assuming that the contacts phone numbers should be
deleted from the devices database.

But how would that be different from doing
a navigator.service.contacts.find(["displayName"], success, fail, obj) and
then a contact.save().  In both cases there are no phone numbers so they
would be deleted again.

I guess the problem is how can one tell of a property has been deleted
versus not being requested as part of a find operation?

My current thinking on how to resolve this problem is to add a new method to
the ContactWriter interface to delete contact properties specified in the
method call.

PendingOp delete (in DOMString[] fields, in SuccessCB successCB, in optional
ErrorCB? errorCB);

This way the programmer could delete individual fields from the contact.  If
they want to delete the entire contact then they would call the remove
method.  However, this doesn't fix the problem when the programmer wants to
delete 1 of the users 3 phoneNumbers.

Simon Mac Donald
http://hi.im/simonmacdonald

Received on Wednesday, 3 November 2010 19:37:29 UTC